public RedirectToRouteResult AddToCartQuantity(Cart cart, int ID, string returnUrl,int quantity)
 {
     FOOD food = _repository.Foods.FirstOrDefault(p => p.ID == ID);
     if (food != null)
     {
         cart.AddItem(food, quantity);
     }
     return RedirectToAction("Index", new { returnUrl });
 }
 public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     // get the Cart from the session
     Cart cart = (Cart)controllerContext.HttpContext.Session[sessionKey];
     // create the Cart if there wasn't one in the session data
     if (cart == null)
     {
         cart = new Cart();
         controllerContext.HttpContext.Session[sessionKey] = cart;
     }
     // return the cart
     return cart;
 }
 public RedirectToRouteResult UpdateQuantity(Cart cart, int ID, int quantity, string returnUrl)
 {
     FOOD food = _repository.Foods.FirstOrDefault(p => p.ID == ID);
     cart.UpdateQuantity(food, quantity);
     return RedirectToAction("Index", new {returnUrl});
 }
 public ViewResult Summary(Cart cart)
 {
     return View(cart);
 }
 public RedirectToRouteResult RemoveFromCart(Cart cart, int foodId, string returnUrl)
 {
     FOOD food = _repository.Foods.FirstOrDefault(p => p.ID == foodId);
     if (food != null)
     {
         cart.RemoveItem(food);
     }
     return RedirectToAction("Index", new {returnUrl});
 }
        public ViewResult Index(Cart cart, string returnUrl)
        {
            if (cart.Items.Count() == 0)
            {
                Redirect(returnUrl);

            }
            ViewData["ImageCDN"] = _imageCDN;
            return View(new CartIndexViewModel
                            {
                                Cart = cart,
                                ReturnUrl = returnUrl
                            });
        }