Exemple #1
0
 public void UpdateItem(string updateCartID, int updateProductID)
 {
     using (var _db = new BASITraining.Models.p_context())
     {
         try
         {
             var myItem = (from c in _db.coursecartitems where c.CartId == updateCartID && c.Product.ProductID == updateProductID select c).FirstOrDefault();
             if (myItem != null)
             {
                 _db.SaveChanges();
             }
         }
         catch (Exception exp)
         {
             throw new Exception("ERROR: Unable to Update Cart Item - " + exp.Message.ToString(), exp);
         }
     }
 }
Exemple #2
0
 public void DeleteItem(string removeCartID)
 {
     using (var _db = new BASITraining.Models.p_context())
     {
         try
         {
             var myItem = (from c in _db.coursecartitems where c.CartId == removeCartID select c).FirstOrDefault();
             if (myItem != null)
             {
                 // Remove Item.
                 _db.coursecartitems.Remove(myItem);
                 _db.SaveChanges();
             }
         }
         catch (Exception exp)
         {
             throw new Exception("ERROR: Unable to Remove Cart Item - " + exp.Message.ToString(), exp);
         }
     }
 }