예제 #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));
 }
예제 #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));
 }