Exemple #1
0
        public AccountHolderValidation(IAccountHolderService accountHolderService)
        {
            _accountHolderService = accountHolderService;

            RuleFor(ach => ach.FirstName).NotEmpty().WithMessage("First Name cannot be empty");

            RuleFor(ach => ach.LastName).NotEmpty().WithMessage("Last Name cannot be empty");

            RuleFor(ach => ach.Email)
            .NotEmpty().WithMessage("Please Enter your Email")
            .Must(ValidateEmail).WithMessage(x => $"User with the email {x.Email} already exists");

            RuleFor(ach => ach.PhoneNumber)
            .Length(11).WithMessage("Your Phone Number Must Be 11 digits")
            .NotEmpty().WithMessage("Phone Number Cannot Be Empty");

            RuleFor(ach => ach.Address).NotEmpty().WithMessage("Please Enter Your Address");
            RuleFor(ach => ach.Password).NotEmpty().WithMessage("You definitely need a password");
        }
Exemple #2
0
 public AccountHolderController(IAccountHolderService accountHolderService)
 {
     _accountHolderService = accountHolderService;
 }