Example #1
0
        public async Task <ActionResult <IEnumerable <PagingResult <Box> > > > GetAllBoxes(int?pageIndex = 0, int?pageSize = 5)
        {
            List <Box> boxes = await boxDAO.GetAllBoxes(pageIndex, pageSize);

            if (boxes == null)
            {
                return(NotFound());
            }

            int countBox = await boxDAO.GetCountBox();

            PagingResult <BoxDTO> resultPage = new PagingResult <BoxDTO>()
            {
                Items      = mapper.Map <List <BoxDTO> >(boxes),
                PageIndex  = pageIndex.Value,
                PageSize   = pageSize.Value,
                TotalCount = countBox
            };

            return(Ok(resultPage));
        }