Exemplo n.º 1
0
        public override bool IsValid()
        {
            if (!PersonGroup.IsValid())
            {
                AddOtherErrorList(PersonGroup.ValidationResult.Errors);
            }

            RuleFor(c => c.IdApi)
            .NotEmpty().WithMessage("Person.IdApi.NotEmpty");

            RuleFor(c => c.IdUsers)
            .GreaterThan(0).WithMessage("Person.IdUser.GreaterThanZero");

            RuleFor(c => c.Name)
            .NotEmpty().WithMessage("Person.Name.NotEmpty")
            .Length(2, 255).WithMessage("Person.Name.LengthBetween2And255");

            ValidateCars();
            ValidateFaces();

            return(ValidationResult.IsValid);
        }
Exemplo n.º 2
0
 public Person()
 {
     PersonGroup = new PersonGroup();
     Cars        = new List <Car>();
     Faces       = new List <Face>();
 }