Example #1
0
 public AddDataVerifierValidator(IUserRules userRules, IProjectRules projectRules)
 {
     RuleFor(_ => _.ProjectId)
     .NotEmpty()
     .WithMessage("Project must be specified");
     RuleFor(_ => _.UserId)
     .NotEmpty()
     .WithMessage("UserId must be specified");
     RuleFor(_ => _)
     .Must(p => userRules.IsUserExisting(p.UserId))
     .WithMessage("User is not existing");
     RuleFor(_ => _)
     .Must(p => projectRules.IsUserNotAVerifier(p.ProjectId, p.UserId))
     .WithMessage("User is already a verifier");
 }
Example #2
0
 public CreateProjectValidator(IProjectRules projectRules)
 {
     RuleFor(_ => _.Name)
     .NotEmpty()
     .WithMessage("Name is mandatory");
     RuleFor(_ => _)
     .Must(p => projectRules.IsProjectNameUnique(p.Name))
     .WithMessage("Project name is already in use");
     RuleFor(_ => _.DataOwnerId)
     .NotEmpty()
     .WithMessage("Data owner id is mandatory");
     RuleFor(_ => _.NationalSocietyId)
     .NotEmpty()
     .WithMessage("National society id is mandatory");
     RuleFor(_ => _.SurveillanceContext)
     .NotEmpty()
     .WithMessage("Surveillance context is mandatory");
 }