Exemple #1
0
        public async Task Should_Get_Color_List()
        {
            var listColorQueryHandler = new ListColorQueryHandler(_colorRepository);
            var request = ListColorQueryRequest.New("nome", "ASC", 1, 1);

            var pagination = await listColorQueryHandler.Handle(request, new CancellationToken());

            Assert.NotNull(pagination);
        }
Exemple #2
0
        public async Task <IPagination <ColorQueryDto> > Handle(ListColorQueryRequest request, CancellationToken cancellationToken)
        {
            var pagination = await _colorRepository.ListAsync(request.Filter, request.OrderBy, request.Page, request.QtyPerPage);

            if (pagination.IsEmpty())
            {
                return(Pagination <ColorQueryDto> .Empty);
            }

            var colorDtos = ColorMapper.Map(pagination.Entities);

            var paginationDto = Pagination <ColorQueryDto> .New(colorDtos, pagination.TotalPages, pagination.ItemsPerPage, pagination.CurrentPage);

            return(paginationDto);
        }