Issue
I want a decimal type variable to be greater than zero with fluent validation. How can I do this control with fluent validation?
- Daily rental fee must be greater than zero
*** DailyPrice is decimal type
public class CarValidator : AbstractValidator<Car>
{
public CarValidator()
{
RuleFor(p => p.Name).MinimumLength(2);
RuleFor(p => p.DailyPrice).MinimumLength(2);
}
}
Solution
Try this:
RuleFor(p => p.DailyRentalFee).GreaterThan(0);
Answered By - Arib Yousuf Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.