public EFCreateOrderCommand(EstoreContext context, CreateOrderValidator validator, IApplicationActor actor, IMapper mapper) { _context = context; _validator = validator; _actor = actor; _mapper = mapper; }
public UpdateProductValidator(EstoreContext context) { _context = context; RuleFor(c => c.Name).NotEmpty().WithMessage("Product name is required").Must(n => _context.Products.Where(pr => pr.Name != n).All(p => p.Name != n)).WithMessage("Name already exist in database!") .MaximumLength(80).WithMessage("Product must have less than 80 characters."); RuleFor(c => c.Description).NotEmpty().WithMessage("Description is required").MaximumLength(200).WithMessage("Product must have less than 200 characters."); RuleFor(c => c.Stock).NotEmpty().WithMessage("Stock is required"); RuleFor(c => c.Price).NotEmpty().WithMessage("Price is required").GreaterThan(0).WithMessage("Price must be greater than 0!"); }
public CreateOrderLineValidator(EstoreContext context) { _context = context; RuleFor(x => x.ProductId) .Must(ProductExists) .WithMessage("Product with an id of {PropertyValue} doesn't exist.") .DependentRules(() => { RuleFor(x => x.Quantity) .GreaterThan(0) .WithMessage("Quantity must be greater than 0") .Must(QuantityDoesentExeedProductQuantity) .WithMessage("Defined quantity ({PropertyValue}) is unavailable."); }); }
public CreateOrderValidator(EstoreContext context) { _context = context; RuleFor(o => o.Address) .NotEmpty() .WithMessage("Address is required") .MaximumLength(80) .WithMessage("Address must have less than 80 characters."); RuleFor(o => o.OrderLines) .NotEmpty() .WithMessage("There must be at least one product") .Must(ol => ol.Select(p => p.ProductId).Distinct().Count() == ol.Count()) .WithMessage("You cannot order duplicate products!") .DependentRules(() => { RuleForEach(x => x.OrderLines).SetValidator (new CreateOrderLineValidator(_context)); }); }
public DatabaseUseCaseLogger(EstoreContext context) { _context = context; }
public EFGetProductsQuery(EstoreContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public EFGetOneOrderQuery(EstoreContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public EFUpdateOrderStatusCommand(EstoreContext context) { _context = context; }
public EFCreateUserCommand(EstoreContext context, CreateUserValidator validator, IEmailSender sender) { _context = context; _validator = validator; _sender = sender; }
public EFCreateProductCommand(CreateProductValidator validator, EstoreContext context) { _validator = validator; _context = context; }
public EFCreateNewPictureCommand(EstoreContext context) { _context = context; }
public EFUpdateCategoryCommand(EstoreContext context, UpdateCategoryValidator validator) { _context = context; _validator = validator; }
public EFGetCategoriesQuery(EstoreContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public EFGetOneProductPictures(EstoreContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public EFUpdateRoleCommand(EstoreContext context, UpdateRoleValidator validator) { _context = context; _validator = validator; }
public EFGetOrdersQuery(EstoreContext context, IApplicationActor actor, IMapper mapper) { _context = context; _actor = actor; _mapper = mapper; }
public EFGetUsersQuery(EstoreContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public EFDeleteOneProductPicturesCommand(EstoreContext context) { _context = context; }
public EFDeleteUserCommand(EstoreContext context) { _context = context; }
public EFDeleteCategoryCommand(EstoreContext context) { _context = context; }
public EFDeleteProductCommand(EstoreContext context) { _context = context; }
public EFGetRolesQuery(EstoreContext context, IMapper mapper) { this.context = context; _mapper = mapper; }
public JwtManager(EstoreContext context) { _context = context; }
public CreateRoleValidator(EstoreContext context) { RuleFor(x => x.Name).NotEmpty().Must(name => !context.Roles.Any(r => r.Name == name)).WithMessage("Role name already exist"); }