Пример #1
0
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IngredientCategory ingredientCategory = _ingredientCategoryService.GetById(id);

            if (ingredientCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(ingredientCategory));
        }
        public IHttpActionResult GetGroceryCategory(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var ingredientCategory = _ingredientCategoryService.GetById(id);

            if (ingredientCategory == null)
            {
                return(NotFound());
            }

            var ingredientCategoryModel = ModelFactory.Create(ingredientCategory);

            return(Ok(ingredientCategoryModel));
        }