I want a decimal type variable to be greater than zero with fluent validation. How can I do this control with fluent validation?
*** DailyPrice is decimal type
public class CarValidator : AbstractValidator<Car>
{
public CarValidator()
{
RuleFor(p => p.Name).MinimumLength(2);
RuleFor(p => p.DailyPrice).MinimumLength(2);
}
}
Try this:
RuleFor(p => p.DailyRentalFee).GreaterThan(0);