public static string QualifiedAction(
     this Microsoft.AspNetCore.Mvc.IUrlHelper url,
     string actionName,
     string controllerName,
     object routeValues = null)
 {
     return(url.Action(actionName, controllerName,
                       routeValues,
                       url.ActionContext.HttpContext.Request.Scheme));
 }
Esempio n. 2
0
 public override void Process(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)
 {
     Microsoft.AspNetCore.Mvc.IUrlHelper           urlHelper = urlHelperFactory.GetUrlHelper(ViewContext);
     Microsoft.AspNetCore.Mvc.Rendering.TagBuilder result    = new Microsoft.AspNetCore.Mvc.Rendering.TagBuilder("div");
     for (int i = 1; i <= PageModel.TotalPages; i++)
     {
         Microsoft.AspNetCore.Mvc.Rendering.TagBuilder tag = new Microsoft.AspNetCore.Mvc.Rendering.TagBuilder("a");
         PageUrlValues["productPage"] = i;
         tag.Attributes["href"]       = urlHelper.Action(PageAction, PageUrlValues);
         if (PageClassesEnabled)
         {
             tag.AddCssClass(PageClass);
             tag.AddCssClass(i == PageModel.CurrentPage ? PageClassSelected : PageClassNormal);
         }
         tag.InnerHtml.Append(i.ToString());
         result.InnerHtml.AppendHtml(tag);
     }
     output.Content.AppendHtml(result.InnerHtml);
 }