public HttpStatusCode Insert(Comment comm) { if (ModelState.IsValid) { Adapter.CommentRepository.Insert(comm); Adapter.Save(); return HttpStatusCode.Created; } throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); }
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)); }