public HttpStatusCode Insert(Category cat) { if (ModelState.IsValid) { Adapter.CategoryRepository.Insert(cat); Adapter.Save(); return HttpStatusCode.Created; } throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); }
public HttpStatusCode Update(int id, Category cat) { if (ModelState.IsValid && id == cat.CategoryId) { Adapter.CategoryRepository.Update(cat); Adapter.Save(); return HttpStatusCode.OK; } throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); }