示例#1
0
        public async Task<IHttpActionResult> Post(int id, CommentRequestModel comment)
        {
            var postedComment = await this.commentsService.AddNew(id, comment.CommentText, this.CurrentUser.UserName);

            var model = await this.commentsService
                .CommentById(postedComment.Id)
                .Project()
                .To<CommentResponseModel>()
                .FirstOrDefaultAsync();

            return this.Data(model);
        }
示例#2
0
 public async Task<IHttpActionResult> Edit(CommentRequestModel comment)
 {
     var edittedComment = await this.commentsService.EditComment(comment.Id, comment.CommentText, this.CurrentUser.UserName, this.CurrentUser.IsAdmin);
     var model = this.mappingService.Map<CommentResponseModel>(edittedComment);
     return this.Data(model);
 }