// PUT api/<controller>/5 public IHttpActionResult Put(CompanyCategory companyCategory) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); if (service.GetCompanyCategory(companyCategory.ID) != null) { service.UpdateCompanyCategory(companyCategory); result = Ok(companyCategory); } else { result = NotFound(); } return(result); }
// GET api/<controller>/5 public IHttpActionResult Get(int id) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); CompanyCategory companyCategory = service.GetCompanyCategory(id); if (companyCategory != null) { result = Ok(companyCategory); } else { result = NotFound(); } return(result); }
// DELETE api/<controller>/5 public IHttpActionResult Delete(int id) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); CompanyCategory companyCategory = service.GetCompanyCategory(id); if (companyCategory != null) { service.RemoveCompanyCategory(id); result = Ok(true); } else { result = NotFound(); } return(result); }