public NewPasswordDtoValidator(HotChocolateDbContext dbContext) { RuleFor(x => x.NewPassword) .MinimumLength(8); RuleFor(x => x.ConfirmNewPassword) .Equal(e => e.NewPassword); }
public AddressService(HotChocolateDbContext context, AuthenticationSettings authenticationSettings, IMapper mapper, IUserContextService userContextService) { _context = context; _authenticationSettings = authenticationSettings; _mapper = mapper; _userContextService = userContextService; }
public RegisterUserDtoValidator(HotChocolateDbContext dbContext) { RuleFor(x => x.Email) .NotEmpty() .EmailAddress() .MaximumLength(35); RuleFor(x => x.FirstName) .MinimumLength(1) .MaximumLength(35); RuleFor(x => x.PhoneNumber) .Length(9); RuleFor(x => x.LastName) .MinimumLength(1) .MaximumLength(35); RuleFor(x => x.Password) .MinimumLength(8); RuleFor(x => x.ConfirmPassword) .Equal(e => e.Password); RuleFor(x => x.Email) .Custom((value, context) => { var emailInUse = dbContext.Users.Any(u => u.Email == value); if (emailInUse) { context.AddFailure("Email", "That email is taken"); } }); }
public CreateAccountDtoValidator(HotChocolateDbContext dbContext) { RuleFor(x => x.Email) .NotEmpty() .EmailAddress() .MaximumLength(35); RuleFor(x => x.FirstName) .MinimumLength(1) .MaximumLength(35); RuleFor(x => x.PhoneNumber) .Length(9); RuleFor(x => x.LastName) .MinimumLength(1) .MaximumLength(35); RuleFor(x => x.Password) .MinimumLength(8); RuleFor(x => x.Email) .Custom((value, context) => { var emailInUse = dbContext.Users.Any(u => u.Email == value); if (emailInUse) { context.AddFailure("Email", "That email is taken"); } }); RuleFor(x => x.RoleId) .NotEmpty() .Custom((value, context) => { if (!(value > 0 && value < 5)) { context.AddFailure("RoleId", "RoleId musi być między 1, a 4."); } }); }
public AccountService(HotChocolateDbContext context, IPasswordHasher <User> passwordHasher, AuthenticationSettings authenticationSettings, IMapper mapper, IUserContextService userContextService) { _context = context; _passwordHasher = passwordHasher; _authenticationSettings = authenticationSettings; _mapper = mapper; _userContextService = userContextService; }
public UpdateProductDtoValidator(HotChocolateDbContext dbContext) { RuleFor(x => x.Name) .NotEmpty(); RuleFor(x => x.Amount) .GreaterThan(0); RuleFor(x => x.Price) .GreaterThan(0); }
public UpdateDetailsValidator(HotChocolateDbContext context) { RuleFor(x => x.FirstName) .MinimumLength(2) .MaximumLength(57); // według wujka google RuleFor(x => x.LastName) .MinimumLength(2) .MaximumLength(81); // według wujka google RuleFor(x => x.PhoneNumber) .Length(9); //BO JESTESMY W POLSCE }
public ManageAccountDtoValidator(HotChocolateDbContext dbContext) { RuleFor(x => x.IsActivated) .NotEmpty() .Custom((value, context) => { if (value.GetType() != typeof(bool)) { context.AddFailure("IsActivated", "Value must be true or false"); } }); }
public OpinionDtoValidator(HotChocolateDbContext dbContext) { RuleFor(x => x.Stars) .NotEmpty() .Custom((value, context) => { if (value > 5 || value < 1) { context.AddFailure("Opinion", "Value must be from 1 to 5"); } }); RuleFor(x => x.DescriptionOfOpinion) .NotEmpty() .MaximumLength(1000); }
public FileService(HotChocolateDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public BlogService(HotChocolateDbContext context, IMapper mapper, IUserContextService userContextService) { _context = context; _mapper = mapper; _userContextService = userContextService; }
public AccountService(HotChocolateDbContext context, IPasswordHasher <User> passwordHasher, AuthenticationSettings authenticationSettings) { _context = context; _passwordHasher = passwordHasher; _authenticationSettings = authenticationSettings; }
public HotChocolateSeeder(HotChocolateDbContext dbContext, IPasswordHasher <User> passwordHasher) { _dbContext = dbContext; _passwordHasher = passwordHasher; }
public HotChocolateSeeder(HotChocolateDbContext dbContext) { _dbContext = dbContext; }