コード例 #1
0
 public void Should_Add_Service_Event()
 {
     var commentsController = new CommentsController();
     var c = new Comment();
     c.AuthorName = "artur";
     c.Body = "boody";
     c.Subject = "sub";
     var result = commentsController.Comment(null, c, "POST");
 }
コード例 #2
0
 public JsonResult Comment(int? id, Comment item, string httpVerb)
 {
     switch (httpVerb)
     {
         case "POST":
             return this.Json(this.commentManager.Create(item));
         case "PUT":
             return this.Json(this.commentManager.Update(item));
         case "GET":
             return this.Json(this.commentManager.GetById(id.GetValueOrDefault()), JsonRequestBehavior.AllowGet);
         case "DELETE":
             return this.Json(this.commentManager.Delete(id.GetValueOrDefault()));
     }
     return this.Json(new { Error = true, Message = "Unknown HTTP verb" });
 }
コード例 #3
0
 public List<Comment> GetComments(int? page, int? count)
 {
     var comment1 = new Comment
     {
         Id = 1,
         Subject = "First Subject",
         Body = "First Body",
         AuthorName = "First Author"
     };
     var comment2 = new Comment
     {
         Id = 2,
         Subject = "Second Subject",
         Body = "Second Body",
         AuthorName = "Second Author"
     };
     var items = new List<Comment> { comment1, comment2 };
     return items;
 }
コード例 #4
0
 public Comment Create(Comment item)
 {
     item.Id = 1;
     return item;
 }
コード例 #5
0
 public Comment Update(Comment item)
 {
     return item;
 }