Пример #1
0
 public static MvcHtmlString PermissionActionLink(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));
     }
     else
     {
         if (showActionLinkAsDisabled)
         {
             TagBuilder tagBuilder = new TagBuilder("span");
             tagBuilder.InnerHtml = linkText;
             return(MvcHtmlString.Create(tagBuilder.ToString()));
         }
         else
         {
             return(MvcHtmlString.Empty);
         }
     }
 }