public async Task <IActionResult> Get([FromQuery] RequestResourceParameters resourceParameters) { //task: add dto and links to previous next apges var requests = _requestRepo.GetAllPagination(resourceParameters); //map requests to requestsDto var mappedRequests = _mapper.Map <IEnumerable <RequestDto> >(requests); //Construct links to previous+ next page var previousPage = requests.HasPrevious ? _linkService.CreateResourceUri(resourceParameters, ResourceType.PreviousPage) : null; var nextPage = requests.HasNext ? _linkService.CreateResourceUri(resourceParameters, ResourceType.NextPage) : null; //construct further links for every request mappedRequests = mappedRequests.Select(request => { request = _linkService.CreateLinks(request); return(request); }); var paginationMetadata = new { totalCount = requests.TotalCount, pageSize = requests.PageSize, currentPage = requests.CurrentPage, totalPages = requests.TotalPages, previousPageLink = previousPage, nextPageLink = nextPage }; return(Ok(new { Values = mappedRequests, Metadata = paginationMetadata })); }