Example #1
0
 public static MvcHtmlString ActionLinkAuthorized(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, RouteValueDictionary routeValues, IDictionary <string, object> htmlAttributes, bool showActionLinkAsDisabled)
 {
     if (htmlHelper.ActionAuthorized(actionName, controllerName))
     {
         return(htmlHelper.ActionLink(linkText, actionName, controllerName, routeValues, htmlAttributes));
     }
     if (showActionLinkAsDisabled)
     {
         TagBuilder tagBuilder = new TagBuilder("span");
         tagBuilder.InnerHtml = linkText;
         return(MvcHtmlString.Create(tagBuilder.ToString()));
     }
     return(MvcHtmlString.Empty);
 }