示例#1
0
        public IActionResult Detail(int id)
        {
            Recipe recipe = recipeDAO.GetRecipeById(id);

            if (recipe == null)
            {
                return(NotFound());
            }
            return(View(recipe));
        }
        public ActionResult <Recipe> GetRecipeById(int id)
        {
            Recipe recipe = dao.GetRecipeById(id);

            if (recipe == null)
            {
                return(NotFound());
            }
            return(Ok(recipe));
        }
示例#3
0
        /// <summary>
        /// Shows detail for a single recipe
        /// </summary>
        /// <param name="id">Id of the recipe to show</param>
        /// <returns></returns>
        public IActionResult Detail(int id)
        {
            // Use the DAO to get the recipe
            Recipe recipe = recipeDAO.GetRecipeById(id);

            if (recipe == null)
            {
                // Recipe not found - 404
                return(NotFound());
            }

            // Recipe was found. Invode the Detail view to show it.
            return(View(recipe));
        }
示例#4
0
        public ActionResult <Recipe> GetOneRecipe(int id)
        {
            Recipe recipe = recipeDAO.GetRecipeById(id);

            if (recipe == null)
            {
                return(NotFound());
            }
            return(recipe);
        }
示例#5
0
        public IActionResult Detail(int id)
        {
            Recipe recipe = recipeDAO.GetRecipeById(id);

            return(View(recipe));
        }