示例#1
0
 public ActionResult Update(ShoopingCartView model, int id)
 {
     try
     {
         if (!ModelState.IsValid) return View(model);
         model.Id = id;
         _cartrepository.Update(model);
         return RedirectToAction("MyCart");
     }
     catch
     {
         return View(model);
     }
 }
示例#2
0
        public void Update(ShoopingCartView modelVie)
        {
            using (var rep = new ShoppingCartRepository())
               {
               var dev = rep.GetById(modelVie.Id);

               if (dev != null)
               {

                   dev.Qty = modelVie.Qty;
                   dev.SubCost = modelVie.Qty*dev.Price;

                   rep.Update(dev);
               }
               }
        }