public void UpdateCart(int updateCartID, int updateItemCart, int quantity) { using (context = new MrDeliveryContext()) { try { var myItem = (from c in context.Carts where c.Id == updateCartID/* && c.ItemNo == updateItemCart*/ select c).FirstOrDefault(); if (myItem != null) { myItem.Quantity = quantity; context.SaveChanges(); } } catch (Exception ex) { throw new Exception("Error: Unable to update the cart " + ex.Message.ToString()); } } }
// public string cartId { get; set; } // public const string cartSession = "CartId"; public ProductsController(DbContextOptions <MrDeliveryContext> option) { context = new MrDeliveryContext(option); _disposeContext = true; }
public AccountController(DbContextOptions <MrDeliveryContext> option) { context = new MrDeliveryContext(option); _disposeContext = true; }
public RestaurantController(DbContextOptions <MrDeliveryContext> option) { context = new MrDeliveryContext(option); }
public CustomerController(DbContextOptions <MrDeliveryContext> option) { context = new MrDeliveryContext(option); }