Beispiel #1
0
        public async Task <ActionResult <PageablePresenter <CategoryPresenter> > > Get([FromQuery] int page = 1, [FromQuery] int size = 15)
        {
            Pageable <Category> result = await _categoryService.GetAll(page, size);

            if (result.IsNullOrEmpty())
            {
                return(NotFound());
            }
            var categories = new PageablePresenter <CategoryPresenter>(page, result.TotalPages);

            result.ForEach(r => categories.Content.Add(new CategoryPresenter(r)));
            return(categories);
        }