public ActionResult Add(EntitieServices.EntitiProductShop.Product pr) { if (Session["cart"] == null) { cart = new List <Item>(); cart.Add(new Item((Models.Product)_productClient.FindProduct(pr.ProductID), 1)); Session["cart"] = cart; ViewBag.cart = cart.Count(); Session["count"] = 1; } else { cart = (List <Item>)Session["cart"]; int index = IsExisting(pr.ProductID); if (index == -1) { cart.Add(new Item((Models.Product)_productClient.FindProduct(pr.ProductID), 1)); Session["cart"] = cart; ViewBag.cart = cart.Count(); Session["count"] = Convert.ToInt32(Session["count"]) + 1; } } return(RedirectToAction("Index", "Products")); }