public void RemoveItem(ShoppinCartUpdates cartItem) { try { var context = GetContext(); var itemRemove = GetCartItemByCartIdAndProductId(shoppingCartId, cartItem.produtoId); if (itemRemove != null) { context.ShoppingCartItems.Remove(itemRemove); SaveChangesModel(); } } catch (Exception ex) { throw new Exception("ERROR: Unable to Remove item of the Cart in Database - Please contact the administrator of system" + ex.Message, ex); } }
public void UpdateItem(ShoppinCartUpdates cartItem) { try { GetContext(); shoppingCartId = GetCartId(); var itemUpdate = GetCartItemByCartIdAndProductId(shoppingCartId, cartItem.produtoId); if (itemUpdate != null) { itemUpdate.Quantity = cartItem.purchaseQuantity; SaveChangesModel(); } } catch (Exception ex) { throw new Exception("ERROR: Unable to Update item of the Cart in Database - Please contact the administrator of system" + ex.Message, ex); } }