public static ComponentBuilder <MvcBootstrapConfig <TModel>, TTag> SetLinkAction <TTag, TModel>(
     this ComponentBuilder <MvcBootstrapConfig <TModel>, TTag> builder, ActionResult result)
     where TTag : Tag, IHasLinkExtensions
 {
     if (result != null)
     {
         IT4MVCActionResult callInfo = result.GetT4MVCResult();
         builder.SetHref(UrlHelper.GenerateUrl(null, callInfo.Action, callInfo.Controller, callInfo.Protocol, null, null, result.GetRouteValueDictionary(),
                                               builder.GetConfig().GetHtmlHelper().RouteCollection, builder.GetConfig().GetHtmlHelper().ViewContext.RequestContext, true));
     }
     return(builder);
 }
Ejemplo n.º 2
0
        public static ComponentBuilder <MvcBootstrapConfig <TModel>, TTag> SetRoute <TTag, TModel>(
            this ComponentBuilder <MvcBootstrapConfig <TModel>, TTag> builder, string routeName, object routeValues = null)
            where TTag : Tag, IHasLinkExtensions
        {
            RouteValueDictionary routeValueDictionary = routeValues == null ? new RouteValueDictionary() : routeValues as RouteValueDictionary;

            if (routeValueDictionary == null)
            {
                new RouteValueDictionary(routeValues);
            }
            builder.SetHref(UrlHelper.GenerateUrl(routeName, null, null, routeValueDictionary,
                                                  builder.GetConfig().HtmlHelper.RouteCollection, builder.GetConfig().HtmlHelper.ViewContext.RequestContext, false));
            return(builder);
        }