Skip to content

Instantly share code, notes, and snippets.

@sskset
Created September 3, 2019 13:01
Show Gist options
  • Save sskset/0908e65eb61876a1ba722b753a542137 to your computer and use it in GitHub Desktop.
Save sskset/0908e65eb61876a1ba722b753a542137 to your computer and use it in GitHub Desktop.
FluentValidationValidatorSample
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