Пример #1
0
        public IActionResult Save([FromForm] Dish dish)
        {
            if (ModelState.IsValid)
            {
                if (dish.Id != Guid.Empty)
                {
                    mealService.UpdateDish(dish);
                }
                else
                {
                    dish = mealService.AddDish(dish);
                }

                return(RedirectToAction("Index", "Dish", new { id = dish.Id }));
            }
            return(View(ModelState));
        }