public HttpStatusCode Insert(Company comp) { if (ModelState.IsValid) { Adapter.CompanyRepository.Insert(comp); Adapter.Save(); return HttpStatusCode.Created; } throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); }
public HttpStatusCode Update(int id, Company comp) { if (ModelState.IsValid && id == comp.CompanyId) { comp.ModifiedDate = DateTime.Now; Adapter.CompanyRepository.Update(comp); Adapter.Save(); return HttpStatusCode.OK; } throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); }