Ejemplo n.º 1
0
        public PagedResultOutput <ProductDto> GetProductActive(GetProductPagedInputDto inputDto)
        {
            IQueryable <Product> query;
            var products = _productRepo.GetAll();

            switch (inputDto.Status)
            {
            case ProductStatusInputDto.ARCHIVE:
                query = products.Where(i => i.Status == ProductStatus.ARCHIVE);
                break;

            case ProductStatusInputDto.ACTIVE:
                query = products.Where(i => i.Status == ProductStatus.ACTIVE);
                break;

            default:
                query = products;
                break;
            }

            var result      = query.OrderByDescending(i => i.CreationTime).PageBy(inputDto).ToList();
            var resultCount = query.Count();

            return(new PagedResultOutput <ProductDto>(resultCount, Mapper.Map <List <ProductDto> >(result)));
        }
Ejemplo n.º 2
0
        public PagedResultOutput <ProductDto> Get([FromQuery] GetProductPagedInputDto inputDto)
        {
            var products = _productAppService.GetProductActive(inputDto);

            return(products);
        }