public ActionResult AddProduct(int productID) { SessionHelper session = new SessionHelper(); ViewBag.qty = session.GetProductQty(productID); ViewBag.qty = cartRepo.GetProductQty(session.SessionID, productID); return(View(cartRepo.GetProduct(productID))); }
public ActionResult AddProduct(int productID, string productName, decimal price, int qty) { ShoppingCartRepo cartRepo = new ShoppingCartRepo(); SessionHelper session = new SessionHelper(); if (ModelState.IsValid) { session.SetProductQty(productID, qty); cartRepo.SaveProductVisit(session.SessionID, productID, productName, price, qty); return(RedirectToAction("ViewCart", new { sessionID = session.SessionID })); } else { ViewBag.qty = session.GetProductQty(productID); return(View(cartRepo.GetProduct(productID))); } }