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