public ActionResult Add(int id) { if (TempData["error"] != null) { ViewBag.Error = TempData["error"].ToString(); } CartProductRepo products = new CartProductRepo(); ShoppingCartEntities db = new ShoppingCartEntities(); SessionHelper session = new SessionHelper(); //Stores qty of product added in the cart for display in the view var prodVisit = db.ProductVisits.Where(pv => pv.productID == id && pv.sessionID == session.SessionID).FirstOrDefault(); ViewBag.Qty = (prodVisit != null) ? prodVisit.qtyOrdered : 1; return(View(products.getProduct(id))); }
public ActionResult Index() { CartProductRepo products = new CartProductRepo(); return(View(products.ShowProducts())); }