Exemplo n.º 1
0
        //[SecuredOperation("Sudo,News.List,News.All", Priority = 1)]
        public async Task <Pagination <NewsForReturnDto> > GetListAsync(NewsParams queryParams)
        {
            var spec         = new NewsWithPagingSpecification(queryParams);
            var listFromRepo = await newsDal.ListEntityWithSpecAsync(spec);

            var countSpec = new NewsWithFilterForCountAsyncSpecificaiton(queryParams);
            var totalItem = await newsDal.CountAsync(countSpec);


            var data = mapper.Map <List <News>, List <NewsForReturnDto> >(listFromRepo);

            return(new Pagination <NewsForReturnDto>
                   (
                       queryParams.PageIndex,
                       queryParams.PageSize,
                       totalItem,
                       data
                   ));
        }