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"); }
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(); }
public Handler(SelfImprovDbContext db) { _db = db; }
public Handler(SelfImprovDbContext db, IMapper mapper) { _db = db; _mapper = mapper; }
public Handler(SelfImprovDbContext db, IUserSession userSession) { _db = db; _userSession = userSession; }