public async Task <IActionResult> Get(FilterQuery filter) { try { string pageString = HttpContext.Request.Headers["X-Pagination-Page"]; string resultPerPageString = HttpContext.Request.Headers["X-Pagination-ResultPerPage"]; Int32.TryParse(pageString, out int page); Int32.TryParse(resultPerPageString, out int resultsPerPage); PagedQueryBase query = new PagedQueryBase() { Page = page, ResultsPerPage = resultsPerPage, Filter = filter }; var ads = await _adService.BrowseAsync(query); return(Json(ads)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }