示例#1
0
 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());
         }
     }
 }
示例#2
0
        // public string cartId { get; set; }
        // public const string cartSession = "CartId";

        public ProductsController(DbContextOptions <MrDeliveryContext> option)
        {
            context         = new MrDeliveryContext(option);
            _disposeContext = true;
        }
示例#3
0
 public AccountController(DbContextOptions <MrDeliveryContext> option)
 {
     context         = new MrDeliveryContext(option);
     _disposeContext = true;
 }
示例#4
0
 public RestaurantController(DbContextOptions <MrDeliveryContext> option)
 {
     context = new MrDeliveryContext(option);
 }
示例#5
0
 public CustomerController(DbContextOptions <MrDeliveryContext> option)
 {
     context = new MrDeliveryContext(option);
 }