public ActionResult Show(int recipeId) { Dictionary <string, object> model = new Dictionary <string, object> { }; Recipe selectedRecipe = Recipe.Find(recipeId); List <Ingredient> ingredientsForRecipe = JoinRecipeIngredient.GetIngredientsByRecipe(recipeId); List <Category> categoriesOfRecipe = selectedRecipe.FindCategoryOfRecipe(recipeId); model.Add("recipe", selectedRecipe); model.Add("ingredients", ingredientsForRecipe); model.Add("categories", categoriesOfRecipe); model.Add("id", recipeId); return(View("Detail", model)); }
public ActionResult DeleteIngredient(int recipeId, int ingredientId) { JoinRecipeIngredient.RemoveIngredientFromRecipe(ingredientId, recipeId); return(RedirectToAction("Show")); }