Ejemplo n.º 1
0
        public async Task <Result <IEnumerable <DeveloperListDto> > > ListDevelopersAsync(PaginationDto pagination)
        {
            var query      = _developerRepository.Query();
            var developers = await query
                             .Skip(pagination.CalculateOffset())
                             .Take(pagination.Limit)
                             .Select(d => new DeveloperListDto
            {
                Id   = d.Id,
                Name = d.Name
            })
                             .ToArrayAsync();

            return(new Result <IEnumerable <DeveloperListDto> >(developers, await query.CountAsync()));
        }
Ejemplo n.º 2
0
        public async Task <Result <IEnumerable <ProjectListDto> > > ListProjectsAsync(PaginationDto pagination)
        {
            var query    = _projectRepository.Query();
            var projects = await query
                           .Skip(pagination.CalculateOffset())
                           .Take(pagination.Limit)
                           .Select(d => new ProjectListDto
            {
                Id    = d.Id,
                Title = d.Title
            })
                           .ToArrayAsync();

            return(new Result <IEnumerable <ProjectListDto> >(projects, await query.CountAsync()));
        }