コード例 #1
0
        public async Task <List <ReplyCommentsDto> > GetAllReplyCommentsInfo(Guid commentParentId)
        {
            using (IReplyCommentsService reply = new ReplyCommentsService())
            {
                var data = await reply.GetAllAsync()
                           .Include(m => m.Comment.User)
                           .Where(m => m.Comment.Article.UserId == commentParentId)
                           .OrderByDescending(m => m.CreateTime)
                           .Select(m => new ReplyCommentsDto()
                {
                    NickName               = m.ReplierUser.NickName,       //回复人
                    ByReplyNickName        = m.TargetToReplyUser.NickName, //被回复人
                    ReplyContent           = m.ReplyContent,               //回复内容
                    ImagePath              = m.ReplierUser.ImagePath,
                    ReplierId              = m.ReplierId,                  //回复用户Id
                    TargetToReplyId        = m.TargetToReplyId,            //回复目标用户Id
                    ReplyToTargetCommentId = m.ReplyToTargetCommentId,     //回复目标评论Id
                    Id = m.Id,
                    CommentParentId = m.CommentParentId,
                    CreateTime      = m.CreateTime
                }).ToListAsync();

                return(data);
            }
        }
コード例 #2
0
        public async Task RemoveReturnComment(Guid id)
        {
            using (IReplyCommentsService replyComments = new ReplyCommentsService())
            {
                var data = await replyComments.GetAllAsync().Where(m => m.Id == id).FirstAsync();

                await replyComments.RemoveAsync(data);
            }
        }