public async Task CreateComment(Guid articleId, Guid userId, string content) { using (ICommentService commentService = new CommmentService()) { await commentService.CreateAsync(new Comment() { UserId = userId, ArticleId = articleId, Content = content }); } }
public async Task <List <Dto.CommentDto> > GetCommentByArticleId(Guid articleId) { using (ICommentService service = new CommmentService()) { return(await service.GetOrderAsync(false).Where(m => m.ArticleId == articleId).Include(m => m.User).Select(m => new CommentDto() { UserId = m.UserId, ArticleId = m.ArticleId, CreateTime = m.CreatTime, Comment = m.Content, Email = m.User.Email, Id = m.Id }).ToListAsync()); } }