public async Task <ProductStock> AddAsync(int productId, int quantity) { var stock = new ProductStock { ProductId = productId, Quantity = quantity }; context.Stocks.Add(stock); await context.SaveChangesAsync(); return(stock); }
public async Task <ProductPrice> AddAsync(int productId, int value) { var price = new ProductPrice { ProductId = productId, Value = value }; context.Prices.Add(price); await context.SaveChangesAsync(); return(price); }
public async Task CreateAsync(string description, int price, int stock) { NewFeature(); var product = new Product { Description = description, Price = new ProductPrice { Value = price }, Stock = new ProductStock { Quantity = stock } }; context.Products.Add(product); await context.SaveChangesAsync(); }