I am currently writing my own paged list for ASP.NET Core MVC.
I struggle while creating the following:
I want to create a UrlHelper extension method: Url.PageLink(int page, int pageSize)
Within that extension method I want to return a link which reuses ALL current values for controller, action, querystring and in addition it should add/update the page, pageSize values in the querystring as well.
Questions: From where do I get the current controller and action in the UrlHelper object? What is the best way to rebuild the querystring? I can see it here url.ActionContext.HttpContext.Request.QueryString... but do I really have to manually rebuild it? Or does something like AddQueryStringValue(int key, object value) exist?
Thanks so much in advance!!! Simon