public IHttpActionResult Post(SubCategory subCategory) { IHttpActionResult result = null; SubCategoryService service = new SubCategoryService(); SubCategory newSubCategory = service.InsertSubCategory(subCategory); if (newSubCategory != null) { result = Created <SubCategory>(Request.RequestUri + newSubCategory.ID.ToString(), newSubCategory); } else { result = NotFound(); } return(result); }