コード例 #1
0
        public static void UpdateFormBuilderContext(this HtmlHelper htmlHelper, Action <FormBuilderContext> updateAction)
        {
            if (updateAction == null)
            {
                return;
            }
            FormBuilderContext formBuilderContext = htmlHelper.GetFormBuilderContext();

            updateAction(formBuilderContext);
            htmlHelper.SetFormBuilderContext(formBuilderContext);
        }
コード例 #2
0
        public static FormBuilderContext GetFormBuilderContext(this HtmlHelper htmlHelper)
        {
            IDictionary items = htmlHelper.ViewContext.HttpContext.Items;

            FormBuilderContext builderContext = null;

            if (items.Contains(FormBuilderContextKey))
            {
                builderContext = items[FormBuilderContextKey] as FormBuilderContext;
            }

            if (builderContext == null)
            {
                builderContext = new FormBuilderContext();
                items[FormBuilderContextKey] = builderContext;
            }

            return(builderContext);
        }
コード例 #3
0
ファイル: FormExtensions.cs プロジェクト: isannn/Build.Mvc
        public static FormBuilderContext GetFormBuilderContext(this HtmlHelper htmlHelper)
        {
            IDictionary items = htmlHelper.ViewContext.HttpContext.Items;

            FormBuilderContext builderContext = null;
            if (items.Contains(FormBuilderContextKey))
            {
                builderContext = items[FormBuilderContextKey] as FormBuilderContext;
            }

            if (builderContext == null)
            {
                builderContext = new FormBuilderContext();
                items[FormBuilderContextKey] = builderContext;
            }

            return builderContext;
        }
コード例 #4
0
 public static void SetFormBuilderContext(this HtmlHelper htmlHelper, FormBuilderContext builderContext)
 {
     htmlHelper.ViewContext.HttpContext.Items[FormBuilderContextKey] = builderContext;
 }
コード例 #5
0
ファイル: FormExtensions.cs プロジェクト: isannn/Build.Mvc
 public static void SetFormBuilderContext(this HtmlHelper htmlHelper, FormBuilderContext builderContext)
 {
     htmlHelper.ViewContext.HttpContext.Items[FormBuilderContextKey] = builderContext;
 }