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); }
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); }