Created
September 3, 2019 13:01
-
-
Save sskset/0908e65eb61876a1ba722b753a542137 to your computer and use it in GitHub Desktop.
FluentValidationValidatorSample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FluentValidation; | |
using Users.API.Application.Commands; | |
namespace Users.API.Application.Validators | |
{ | |
public class CreateUserCommandValidator : AbstractValidator<CreateUserCommand> | |
{ | |
public CreateUserCommandValidator() | |
{ | |
RuleFor(x => x.Email).NotNull().NotEmpty(); | |
RuleFor(x => x.MonthlyExpenses).GreaterThanOrEqualTo(0); | |
RuleFor(x => x.MonthlySalary).GreaterThanOrEqualTo(0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment