Пример #1
0
        public ActionResult AddToCart(int dishId, int amount = 1)
        {
            var addedDish = _dish.GetDishById(dishId);

            if (addedDish != null)
            {
                _shoppingCart.AddDish(addedDish, amount);
                _shoppingCart.SaveChanges();
            }

            // get the caller URL which we will redirect to:

            Uri callingUrl = Request.GetTypedHeaders().Referer;

            return(Redirect(callingUrl.OriginalString));
            //return RedirectToAction("Index");
        }