public async Task <IActionResult> AddRecipe(AddRecipeToPlanViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var recipePlan = new RecipePlans { DisplayOrder = model.DisplayOrder, MealName = model.MealName, PlanId = int.Parse(model.ChoosePlan), DayNameId = int.Parse(model.DayName), RecipeId = int.Parse(model.Recipe) }; var result = await _planService.AddRecipeToPlanAsync(recipePlan); if (result == false) { ModelState.AddModelError("", "Błąd dodawania planu"); return(View(model)); } return(RedirectToAction("AddRecipe", "Plan")); }