コード例 #1
0
ファイル: CartActions.cs プロジェクト: Schyguy/henlo
 public void UpdateItem(string updateCartID, int updateGazeboID, int quantity)
 {
     using (var _db = new E_Commerce_Portal.Models.GazeboContext())
     {
         try
         {
             var myItem = (from c in _db.CartItems where c.CartId == updateCartID && c.Gazebo.GazeboID == updateGazeboID select c).FirstOrDefault();
             if (myItem != null)
             {
                 myItem.Quantity = quantity;
                 _db.SaveChanges();
             }
         }
         catch (Exception exp)
         {
             throw new Exception("ERROR: Unable to Update Cart Item - " + exp.Message.ToString(), exp);
         }
     }
 }
コード例 #2
0
ファイル: CartActions.cs プロジェクト: Schyguy/henlo
 public void RemoveItem(string removeCartID, int removeGazeboID)
 {
     using (var _db = new E_Commerce_Portal.Models.GazeboContext())
     {
         try
         {
             var myItem = (from c in _db.CartItems where c.CartId == removeCartID && c.Gazebo.GazeboID == removeGazeboID select c).FirstOrDefault();
             if (myItem != null)
             {
                 // Remove Item.
                 _db.CartItems.Remove(myItem);
                 _db.SaveChanges();
             }
         }
         catch (Exception exp)
         {
             throw new Exception("ERROR: Unable to Remove Cart Item - " + exp.Message.ToString(), exp);
         }
     }
 }