public AddUserValidator( ICrudRepositoryFactory crudRepositoryFactory ) { _repository = crudRepositoryFactory.Get <User>(); RuleFor(x => x.Birthday) .NotNull() .NotEmpty() .WithMessage(Errors.Messages.NoBirthday) .WithErrorCode(Errors.Codes.NoBirthday); RuleFor(x => x.UserName) .NotNull() .NotEmpty() .WithMessage(Errors.Messages.NoUsername) .WithErrorCode(Errors.Codes.NoUsername); RuleFor(x => x) .Must(y => { if (y.IdType != Entities.Enum.IDTypeEnum.Internal) { return(!string.IsNullOrWhiteSpace(y.ExternalID)); } else { return(true); } }); RuleFor(x => x) .MustAsync((x, c) => UserNotYetExist(x)) .WithMessage(Errors.Messages.UserExists) .WithErrorCode(Errors.Codes.UserExists); }
public AuthenticationLoader( ICrudRepositoryFactory crudRepositoryFactory ) { _passwordsRepository = crudRepositoryFactory.Get <PasswordRecord>(); }