public async Task <ActionResult> CreateMeal(Meal entity, List <Ingredient> ingredients) { if (ingredients is null || !ingredients.Any()) { ModelState.AddModelError(string.Empty, "Должен быть хотя бы 1 ингредиент"); entity.Ingredients = new List <Ingredient>(); return(View(entity)); } var meal = await _mealService.CreateMealAsync(entity, ingredients); meal.MenuId = entity.MenuId; meal.Price = entity.Price; await _menuService.AddMealToMenuAsync(meal); return(RedirectToAction("DetailsMenu", new { id = entity.MenuId })); }