public async Task <CommentDTO> CreateCommentAsync(UpdateCommentRequest createdComment) { var dbComment = mapper.Map <Comment>(createdComment); await commentRepository.CreateCommentAsync(dbComment); return(mapper.Map <CommentDTO>(dbComment)); }
public async Task <CommentDTO> UpdateCommentAsync(int commentId, UpdateCommentRequest updatedComment) { var dbComment = await commentRepository.GetCommentAsync(commentId); if (dbComment == null) { return(null); } mapper.Map(updatedComment, dbComment); await commentRepository.UpdateCommentAsync(dbComment); return(mapper.Map <CommentDTO>(dbComment)); }