Пример #1
0
        public ActionResult Edit(int recipeId)
        {
            Dictionary <string, object> model    = new Dictionary <string, object> {
            };
            Recipe            selectedRecipe     = Recipe.Find(recipeId);
            List <Ingredient> allIngredients     = Ingredient.GetAll();
            List <Ingredient> recipesIngredients = JoinRecipeIngredient.GetIngredientsByRecipe(recipeId);

            model.Add("recipe", selectedRecipe);
            model.Add("ingredients", allIngredients);
            model.Add("recipesIngredients", recipesIngredients);
            return(View(model));
        }
Пример #2
0
        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));
        }