示例#1
0
        public RedirectToActionResult AddToCart(int dishId)
        {
            Dish dish = service.GetDish(dishId).Result;


            if (dish != null)
            {
                cart.AddToCart(dish);
            }

            return(RedirectToAction("Index"));
        }
示例#2
0
        public async Task <IActionResult> GetDish(int?id)
        {
            if (id != null)
            {
                Dish dish = await kitchen.GetDish(id);

                if (dish != null)
                {
                    return(View(dish));
                }
            }
            return(NotFound());
        }