Exemplo n.º 1
0
        /// <summary>
        /// Areas the form handler.
        /// </summary>
        /// <param name="sitecoreHelper">The sitecore helper.</param>
        /// <param name="controller">The controller.</param>
        /// <param name="action">The action.</param>
        /// <param name="areaName">Name of the area.</param>
        /// <param name="namespaceName">Name of the namespace.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>Return html tag for area form handler.</returns>
        public static HtmlString AreaFormHandler(this SitecoreHelper sitecoreHelper, string controller, string action, string areaName, string namespaceName, SafeDictionary <string> parameters = null)
        {
            if (controller.IsEmptyOrNull())
            {
                controller = sitecoreHelper.GetValueFromCurrentRendering("Form Controller Name");
            }
            if (action.IsEmptyOrNull())
            {
                action = sitecoreHelper.GetValueFromCurrentRendering("Form Controller Action");
            }
            if (areaName.IsEmptyOrNull())
            {
                areaName = sitecoreHelper.GetValueFromCurrentRendering("Form Controller Area");
            }
            if (namespaceName.IsEmptyOrNull())
            {
                namespaceName = sitecoreHelper.GetValueFromCurrentRendering("Form Controller Namespace");
            }
            if (controller.IsEmptyOrNull())
            {
                return(new HtmlString(string.Empty));
            }
            string str = HiddenField("scController", controller);

            if (!action.IsEmptyOrNull())
            {
                str = string.Concat(str, HiddenField("scAction", action));
            }
            if (!areaName.IsEmptyOrNull())
            {
                str = string.Concat(str, HiddenField("scArea", areaName));
            }
            if (!namespaceName.IsEmptyOrNull())
            {
                str = string.Concat(str, HiddenField("scNamespace", namespaceName));
            }
            return(new HtmlString(str));
        }