Created
September 22, 2020 09:43
-
-
Save johnmmoss/3da50635b8a9174c0cf35dc1e760be0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiContext : IApiContext | |
{ | |
private readonly string _baseUri; | |
public ApiContext(string baseUri) | |
{ | |
_baseUri = baseUri; | |
} | |
public Uri GetPageUri(PaginationFilter filter, string route) | |
{ | |
var _enpointUri = new Uri(string.Concat(_baseUri, route)); | |
var modifiedUri = QueryHelpers.AddQueryString(_enpointUri.ToString(), "pageNumber", filter.PageNumber.ToString()); | |
modifiedUri = QueryHelpers.AddQueryString(modifiedUri, "pageSize", filter.PageSize.ToString()); | |
return new Uri(modifiedUri); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code from: https://www.codewithmukesh.com/blog/pagination-in-aspnet-core-webapi/