If you want to use validator create class that inherits from AbstractValidator<ConfigurationModel>

Note: <ConfigurationModel> is used especially in this example.

We created rule, our quantity has to be greater than 1.

In ConfigurationModel you have to add one line.

In controller you handle it with ModelState object.

If value < 1 error will be thrown, example below

back to top