Beispiel #1
0
 /// <summary>
 /// Auth Button
 /// </summary>
 /// <param name="htmlHelper">htmlHelper</param>
 /// <param name="text">text</param>
 /// <param name="authorizeFunc">authorize func</param>
 /// <param name="htmlAttributes">html attributes</param>
 /// <returns></returns>
 public static IHtmlContent AuthButton(this IHtmlHelper htmlHelper, string text, AuthorizeFunc authorizeFunc, object htmlAttributes = null)
 {
     return(AuthButton(htmlHelper, new AuthButtonOptions()
     {
         Text = text,
         AuthorizeFunc = authorizeFunc,
         HtmlAttributes = htmlAttributes?.ObjectToDcitionary()
     }));
 }
Beispiel #2
0
        public static IHtmlContent PreAttributeAuthButton(this IHtmlHelper htmlHelper, string text, AuthorizeFunc authorizeFunc, string attrName, List <string> attrValues = null, object htmlAttributes = null, object icoHtmlAttributes = null)
        {
            var attributesDic = htmlAttributes?.ObjectToDcitionary() ?? new Dictionary <string, object>();

            if (!attrValues.IsNullOrEmpty())
            {
                if (attributesDic.ContainsKey(attrName))
                {
                    attributesDic[attrName] += string.Join(" ", attrValues.ToArray());
                }
                else
                {
                    attributesDic.Add(attrName, string.Join(" ", attrValues.ToArray()));
                }
            }
            return(AuthButton(htmlHelper, new AuthButtonOptions()
            {
                Text = text,
                AuthorizeFunc = authorizeFunc,
                HtmlAttributes = attributesDic,
                UseIco = icoHtmlAttributes != null,
                IcoHtmlAttributes = icoHtmlAttributes?.ObjectToDcitionary()
            }));
        }
Beispiel #3
0
 public static IHtmlContent PreClassAuthButton(this IHtmlHelper htmlHelper, string text, AuthorizeFunc authorizeFunc, List <string> classValues = null, object htmlAttributes = null, object icoHtmlAttributes = null)
 {
     return(PreAttributeAuthButton(htmlHelper, text, authorizeFunc, "class", classValues, htmlAttributes, icoHtmlAttributes));
 }
Beispiel #4
0
 /// <summary>
 /// Dropdown Auth Link
 /// </summary>
 /// <param name="htmlHelper"></param>
 /// <param name="text"></param>
 /// <param name="authorizeFunc"></param>
 /// <param name="htmlAttributes"></param>
 /// <returns></returns>
 public static IHtmlContent DropdownAuthLink(this IHtmlHelper htmlHelper, string text, AuthorizeFunc authorizeFunc, object htmlAttributes = null, object icoHtmlAttributes = null)
 {
     return(AuthLink(htmlHelper, new AuthButtonOptions()
     {
         Text = text,
         AuthorizeFunc = authorizeFunc,
         HtmlAttributes = htmlAttributes?.ObjectToDcitionary(),
         UseIco = icoHtmlAttributes != null,
         IcoHtmlAttributes = icoHtmlAttributes?.ObjectToDcitionary()
     }));
 }