public async Task <ActionResult> Update(UpdateCommentRequestModel model, string commentId) { var loggedUser = this.User.GetId(); var result = await this.commentService.UpdateCommentAsync(model.Content, commentId, loggedUser); if (!result.Success) { return(BadRequest(result.Errors)); } return(Ok(result.Result)); }
public async Task <ActionResult> Update(string commentId, [FromBody] UpdateCommentRequestModel model) { var userId = this.User.GetId(); var updateRequest = await this.commentsService .UpdateAsync(userId, commentId, model.Content); if (!updateRequest.Success) { return(this.BadRequest(new ErrorsResponseModel { Errors = updateRequest.Errors, })); } return(this.Ok()); }
public async Task <ActionResult <InputCommentResponseModel> > UpdateComment( [FromRoute] int id, [FromBody] UpdateCommentRequestModel inputModel) { var userId = this.User.GetId(); var result = await this.commentsService.UpdateAsync( id, userId, inputModel.Content); if (result.Failure) { return(this.BadRequest(result.Error)); } return(new InputCommentResponseModel { CommentId = id }); }