public async Task <Outcome <CommentResponse> > GetCommentAsync(int commentId) { var comment = await _repository.GetAsync(commentId); if (comment == null) { return(Outcome.Fail <CommentResponse>(Status400BadRequest, CommentNotFound)); } return(Outcome.Success(CommentMappingHelper.MapToCommentResponse(comment))); }
public async Task <Outcome <CommentResponse> > UpdateCommentAsync(CommentUpdateRequest request) { var comment = await _repository.GetAsync(request.Id); if (comment == null) { return(Outcome.Fail <CommentResponse>(Status400BadRequest, UpdateFailed)); } comment.Tone = request.Tone; await _repository.SaveAsync(); return(Outcome.Success(CommentMappingHelper.MapToCommentResponse(comment))); }