// PUT api/<controller>/5 public IHttpActionResult Put(SubCategory subCategory) { IHttpActionResult result = null; SubCategoryService service = new SubCategoryService(); if (service.GetSubCategory(subCategory.ID) != null) { service.UpdateSubCategory(subCategory); result = Ok(subCategory); } else { result = NotFound(); } return(result); }