public ActionResult Index() { string username = SessionHelper.GetUserSession(); List <CartSession> cartsessionlist = null; if (username != null) { if (SessionHelper.GetCartSession(username) == null) { return(PartialView(cartsessionlist)); } else { cartsessionlist = SessionHelper.GetCartSession(username); ViewBag.summoney = code.Summoney(cartsessionlist); return(PartialView(cartsessionlist)); } } else { if (SessionHelper.GetCartSession("cart") == null) { ViewBag.summoney = 0; return(PartialView(cartsessionlist)); } else { cartsessionlist = SessionHelper.GetCartSession("cart"); ViewBag.summoney = code.Summoney(cartsessionlist); return(PartialView(cartsessionlist)); } } }