Esempio n. 1
0
 public HttpStatusCode Insert(Category cat)
 {
     if (ModelState.IsValid)
     {
         Adapter.CategoryRepository.Insert(cat);
         Adapter.Save();
         return HttpStatusCode.Created;
     }
     throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));
 }
Esempio n. 2
0
 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));
 }