Пример #1
0
 //评论操作
 public async Task CreateComment(Guid userId, Guid commodityId, string content)
 {
     using (IDAL.ICommentService commentService = new DAL.CommentService())
     {
         await commentService.CreateAsync(new Comment()
         {
             UserId      = userId,
             CommodityId = commodityId,
             Content     = content
         });
     }
 }
Пример #2
0
 public async Task <List <CommentDto> > GetCommentByCommodityId(Guid commodityId)
 {
     using (IDAL.ICommentService commentService = new DAL.CommentService())
     {
         return(await commentService.GetAll(m => m.CommodityId == commodityId, false).Include(m => m.User).Select(m => new Dto.CommentDto()
         {
             Id = m.Id,
             CommodityId = m.CommodityId,
             UserId = m.UserId,
             Email = m.User.Email,
             Content = m.Content,
             CreateTime = m.CreateTime
         }).ToListAsync());
     }
 }