public HttpResponseMessage GetCommentReplies() { ItemsResponse <CommentAdvanced> response = new ItemsResponse <CommentAdvanced>(); response.Items = CommentReplyService.CommentReplySelect(); return(Request.CreateResponse(response)); } //GetCommentReplies
public HttpResponseMessage GetCommentReplyById([FromUri] int commentReplyId) { if (commentReplyId <= 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } ItemResponse <CommentAdvanced> response = new ItemResponse <CommentAdvanced>(); response.Item = CommentReplyService.CommentReplySelectById(commentReplyId); return(Request.CreateResponse(response)); } //GetCommentReplyById
public HttpResponseMessage GetCommentRepliesByCommentId([FromUri] int commentId) { if (commentId <= 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } ItemsResponse <CommentAdvanced> response = new ItemsResponse <CommentAdvanced>(); // pass the list Replies into response response.Items = CommentReplyService.CommentReplySelectByCommentId(commentId); return(Request.CreateResponse(response)); } //GetCommentRepliesByCommentId
[HttpDelete] // <== type of http methods supported public HttpResponseMessage DeleteCommentReply([FromUri] int commentReplyId) { if (commentReplyId <= 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } // create our response model SuccessResponse response = new SuccessResponse(); CommentReplyService.CommentReplyDelete(commentReplyId); return(Request.CreateResponse(response)); } // DeleteCommentReply
public HttpResponseMessage CreateCommentReply([FromBody] CommentReplyAddRequest payload) { if (string.IsNullOrWhiteSpace(payload.Title) || string.IsNullOrWhiteSpace(payload.Content) || string.IsNullOrWhiteSpace(payload.Author) || payload.ParentCommentId <= 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } // create our response model ItemResponse <int> response = new ItemResponse <int>(); response.Item = CommentReplyService.CommentReplyInsert(payload.ParentCommentId, payload.Author, payload.Title, payload.Content); return(Request.CreateResponse(response)); } //CreateCommentReply
[HttpPut] // <== type of http methods supported public HttpResponseMessage UpdateCommentReply([FromUri] int id, [FromBody] CommentReplyUpdateRequest payload) { if (string.IsNullOrWhiteSpace(payload.Title) || string.IsNullOrWhiteSpace(payload.Content) || string.IsNullOrWhiteSpace(payload.Author) || payload.ParentCommentId <= 0 || id <= 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } // create our response model SuccessResponse response = new SuccessResponse(); CommentReplyService.CommentReplyUpdate(payload.id, payload.Title, payload.Content); return(Request.CreateResponse(response)); } // UpdateCommentReply