Beispiel #1
0
 public HttpStatusCode Insert(Comment comm)
 {
     if (ModelState.IsValid)
     {
         Adapter.CommentRepository.Insert(comm);
         Adapter.Save();
         return HttpStatusCode.Created;
     }
     throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));
 }
Beispiel #2
0
 public HttpStatusCode Update(int id, Comment comm)
 {
     if (ModelState.IsValid && id == comm.CommentId)
     {
         comm.ModifiedDate = DateTime.Now;
         Adapter.CommentRepository.Update(comm);
         Adapter.Save();
         return HttpStatusCode.OK;
     }
     throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));
 }