public GetCustomersHttpRequestDtoValidator() { IdPropertyValidator.Rule(RuleFor(dto => dto.After)); IdPropertyValidator.Rule(RuleFor(dto => dto.Before)); LimitPropertyValidator.Rule(RuleFor(dto => dto.Limit)); }
public CustomerDtoValidator() { // CompanyName must be filled, or GivenName and FamilyName RuleFor(dto => dto).Must(c => !string.IsNullOrEmpty(c.CompanyName) || !string.IsNullOrEmpty(c.GivenName) && !string.IsNullOrEmpty(c.FamilyName)); IdPropertyValidator.Rule(RuleFor(dto => dto.Id).NotEmpty()); RuleFor(dto => dto.CreatedAt) .NotEmpty(); RuleFor(dto => dto.State) .NotEmpty(); GivenNamePropertyValidator.Rule(RuleFor(dto => dto.GivenName)); FamilyNamePropertyValidator.Rule(RuleFor(dto => dto.FamilyName)); CompanyNamePropertyValidator.Rule(RuleFor(dto => dto.CompanyName)); LanguageCodePropertyValidator.Rule(RuleFor(dto => dto.LanguageCode).NotEmpty()); }