Example #1
0
        public ActionResult EditIngredient(int id)
        {
            var user = iRepo.GetIngredient(id);

            if (user != null)
            {
                return(View(user));
            }
            return(RedirectToAction("Ingredients"));
        }
Example #2
0
        // the view path, including id is returned from  clickable linked images

        public ActionResult IngredientDetail(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            // i initialized in the ingredient constructor an Id = 1;
            // i used .Value to cast the int? to int.  could have casted explicitly also.
            var ingredient = _ingredientsRepository.GetIngredient(id.Value);

            ViewBag.DictionaryType = Ingredient.TomatoDictionary;

            return(View(ingredient));
        }