public async Task <IActionResult> CreateShoppingCartItem([FromBody] Sales.ShoppingCartItem value) { _db.Sales_ShoppingCartItem.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditShoppingCartItem(int shoppingCartItemID, [FromBody] Sales.ShoppingCartItem value) { var existing = await _db.Sales_ShoppingCartItem.FirstOrDefaultAsync(x => x.ShoppingCartItemID == shoppingCartItemID); if (existing == null) { return(NotFound()); } existing.ShoppingCartItemID = value.ShoppingCartItemID; existing.ShoppingCartID = value.ShoppingCartID; existing.Quantity = value.Quantity; existing.ProductID = value.ProductID; existing.DateCreated = value.DateCreated; existing.ModifiedDate = value.ModifiedDate; _db.Sales_ShoppingCartItem.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }