コード例 #1
0
ファイル: ArticleAppService.cs プロジェクト: DonyGu/KBWebAPI
        public PagedListDto <ArticleWithIncludeDto> GetList(ArticleQueryDto dto, string include, Paging paging)
        {
            var spec  = new ArticleFilterSpecification(dto.CategoryId, dto.TagId, dto.Keywords);
            int count = _articleDomainService.Count(spec);

            spec.ApplyPaging(paging);
            var list = _articleDomainService.List(spec);

            var listIncludes = list.Select(e =>
            {
                ArticleWithIncludeDto toDto = Mapper.Map <ArticleWithIncludeDto>(e);
                HandleInclude(toDto, include);
                return(toDto);
            });

            return(new PagedListDto <ArticleWithIncludeDto>(count, list.Select(e => Mapper.Map <ArticleWithIncludeDto>(e))));
        }