Last active
November 3, 2020 19:26
-
-
Save TBertuzzi/87d71ab48736d918f38a2ce6c8211edd to your computer and use it in GitHub Desktop.
FluentValidation
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 System; | |
using FluentValidation; | |
namespace XamarinFluentValidation.Models.Validators | |
{ | |
public class PessoaValidator : AbstractValidator<Pessoa> | |
{ | |
public PessoaValidator() | |
{ | |
RuleFor(x => x.Nome).NotEmpty().WithMessage("Nome Obrigatório"). | |
MaximumLength(30).WithMessage("O Nome pode ter no maximo 30 caracteres"); | |
RuleFor(x => x.Email).NotEmpty().WithMessage("E-mail Obrigatório"). | |
EmailAddress().WithMessage("E-mail Invalido"); | |
RuleFor(x => x.Estado).NotEmpty().WithMessage("Estado Obrigatório"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment