public async Task AddQuantityToItem(AddQuantityToProductBindingModel input) { var product = await this.context.Products.FirstOrDefaultAsync(p => p.Id == input.Id); product.Quantity += input.Quantity; await context.SaveChangesAsync(); }
public async Task <IActionResult> ProductSingleOrder(AddQuantityToProductBindingModel input) { if (!this.ModelState.IsValid) { return(await this.ProductSingleOrder()); } await this.productService.AddQuantityToItem(input); return(this.Redirect("/Admin/ProductOrder")); }