Exemplo n.º 1
0
        public Task <IReadOnlyList <CommentViewModel> > GetCommentsByUsernameAsync(string username)
        {
            var spec = new CommentSpecial(username, 1, 20);

            var comments = _commentRepository.SelectAsync(spec, c => _mapper.Map <CommentViewModel>(c), false);

            return(comments);
        }
Exemplo n.º 2
0
        public Task <int> CountByUsernameAsync(string username)
        {
            var spec = new CommentSpecial(username);

            var count = _commentRepository.CountAsync(spec);

            return(count);
        }
Exemplo n.º 3
0
        public Task <IReadOnlyList <PostCommentListItem> > GetSelectedOfPostAsync(Guid postId)
        {
            var spec = new CommentSpecial(postId);

            return(_commentRepository.SelectAsync(spec, c => new PostCommentListItem
            {
                Id = c.Id,
                CommentContent = c.CommentContent,
                CreateOnUtc = c.CreateOnUtc,
                Username = c.Username,
                CommentReplies = c.CommentReply.Select(cr => new CommentReplyItem
                {
                    Id = cr.Id,
                    ParentId = c.Id,
                    ReplyContent = cr.ReplyContent,
                    ReplyTimeUtc = cr.ReplyTimeUtc.GetValueOrDefault()
                }).ToList()
            }));
        }