Esempio n. 1
0
 public Validator(SelfImprovDbContext db)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     // TODO: unique per user
     .MustAsync(async(s, ct) => await db.Areas.NoneAsync(x => x.Name == s, ct))
     .WithMessage("Name is already in use. It should be unique");
 }
Esempio n. 2
0
            public Validator(SelfImprovDbContext db)
            {
                RuleFor(x => x.Name).NotEmpty();

                RuleFor(x => x.Email)
                .NotEmpty()
                .EmailAddress()
                .MustAsync(async(s, ct) => await db.Users.NoneAsync(x => x.Email == s, ct))
                .WithMessage("Email is already in use. It should be unique");

                RuleFor(x => x.Password).NotEmpty().Equal(x => x.PasswordConfirmation).WithMessage("The password and confirmation password do not match");

                RuleFor(x => x.PasswordConfirmation).NotEmpty();
            }
Esempio n. 3
0
 public Handler(SelfImprovDbContext db)
 {
     _db = db;
 }
Esempio n. 4
0
 public Handler(SelfImprovDbContext db, IMapper mapper)
 {
     _db     = db;
     _mapper = mapper;
 }
Esempio n. 5
0
 public Handler(SelfImprovDbContext db, IUserSession userSession)
 {
     _db          = db;
     _userSession = userSession;
 }