예제 #1
0
 public virtual Task <PagedResultDto <CommentWithAuthorDto> > GetListAsync(CommentGetListInput input)
 {
     return(CommentAdminAppService.GetListAsync(input));
 }
예제 #2
0
        public virtual async Task <PagedResultDto <CommentWithAuthorDto> > GetListAsync(CommentGetListInput input)
        {
            var totalCount = await CommentRepository.GetCountAsync(
                input.Text,
                input.EntityType,
                input.RepliedCommentId,
                input.Author,
                input.CreationStartDate,
                input.CreationEndDate);

            var comments = await CommentRepository.GetListAsync(
                input.Text,
                input.EntityType,
                input.RepliedCommentId,
                input.Author,
                input.CreationStartDate,
                input.CreationEndDate,
                input.Sorting,
                input.MaxResultCount,
                input.SkipCount
                );

            var dtos = comments.Select(queryResultItem =>
            {
                var dto    = ObjectMapper.Map <Comment, CommentWithAuthorDto>(queryResultItem.Comment);
                dto.Author = ObjectMapper.Map <CmsUser, CmsUserDto>(queryResultItem.Author);

                return(dto);
            }).ToList();

            return(new PagedResultDto <CommentWithAuthorDto>(totalCount, dtos));
        }