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); } }
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); } } }