public OrderWithProductsQueryValidator(IShopContext context) { _context = context; RuleFor(x => x.Id) .NotEmpty() .WithMessage(CommonErrors.ShouldNotBeEmpty) .MustAsync(OrderExists) .WithMessage((query, id) => ValidatorMessageExtensions.FormatMessage(OrderWithProductsQueryErrors.OrderDoesNotExist, id)); }
public ProductLineItemModelValidator(IShopContext context) { _context = context; RuleFor(x => x.Id) .MustAsync(ProductExists) .WithFormattedMessage(CommonCustomFormatterErrors.EntityShouldExist, nameof(Product)); RuleFor(x => x.Quantity) .GreaterThan(0) .WithMessage(CommonErrors.ShouldBeGreaterThan0); }
public CreateOrderCommandValidator(IShopContext context) { _context = context; RuleFor(x => x.Products) .NotEmpty() .WithMessage(CreateOrderCommandErrors.OrderShouldContainAtLeastOneProduct); RuleForEach(x => x.Products) .SetValidator(new ProductLineItemModelValidator(context)) .When(x => x.Products != null && x.Products.Any()); }
public CreateProductCommandValidator(IShopContext context) { _context = context; RuleFor(x => x.Name) .NotEmpty() .WithMessage(CommonErrors.ShouldNotBeEmpty) .MustAsync(ShouldBeUniqueName) .WithMessage(CommonErrors.ShouldBeUnique); RuleFor(x => x.Price) .GreaterThan(0) .WithMessage(CommonErrors.ShouldBeGreaterThan0); RuleFor(x => x.ProductCategoryId) .MustAsync(ProductCategoryExists) .WithFormattedMessage(CommonCustomFormatterErrors.EntityShouldExist, nameof(ProductCategory)); }
private Shop() { context = ShopContextFactory.CreateShopContext(); //memoryItems.AddRange(context.GetAllItems()); maxId = Items.Max(item => item.ArticleNumber); }
public OrderingsController() { db = new ShopContext(); }
public ProductCategoriesQueryHandler(IShopContext context, IMapper mapper) { _context = context; _mapper = mapper; }
//public ItemsRepository() //{ // _db = new ApplicationDbContext(); //} public ItemsRepository(IShopContext db) { _db = db; }
public UsersController(IShopContext ShopContext) { this.db = ShopContext; }
public ProductManager(IShopContext shopContext, IMapper mapper) { _shopContext = shopContext; _mapper = mapper; }
public OrderWithProductsQueryHandler(IShopContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public ProductService(IShopContext context) { _context = context; }
public UserController_Old() { db = new ShopContext(); }
public UserRepository(IShopContext context) { _context = context; }
public ProductRepository(IShopContext context) { _context = context; }
public UnitOfWork(IShopContext db) { _db = db; }
public CreateProductCommandHandler(IShopContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public UserController_Old(IShopContext context) { db = context; }
public CreateOrderCommandHandler(IShopContext context) { _context = context; }
public ProductsController() { db = new ShopContext(); }
public ShopTypeService(IShopContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public ShopRepository(IShopContext context) { this.context = context; }
public UsersController() { db = new ShopContext(); }