public LegalCaseValidatorCreate(ILegalCaseRepo repository) { _repository = repository; RuleFor(x => x.CourtName).NotNull().NotEmpty(); RuleFor(x => x.NameOfResponsible).NotNull().NotEmpty(); RuleFor(x => x.CaseNumber).NotNull().NotEmpty().Length(25).Must(IsUniqueCase) .WithMessage("The Case Number must be unique"); RuleFor(x => x.CaseNumber).NotNull().NotEmpty().Length(25) .Matches("[0-9]{7}-[0-9]{2}[.][0-9]{4}[.][0-9][.][0-9]{2}[.][0-9]{4}") .WithMessage("The Case Number has to be the format 'NNNNNNN-NN.NNNN.N.NN.NNNN'"); }
public LegalCasesController(ILegalCaseRepo repository, IMapper mapper) { _repository = repository; _mapper = mapper; }