コード例 #1
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            var model    = new HtmlBodyPartSettingsViewModel();
            var settings = new HtmlBodyPartSettings();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix))
            {
                settings.SanitizeHtml = model.SanitizeHtml;

                context.Builder.WithSettings(settings);
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #2
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(HtmlBodyPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new HtmlBodyPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Editor))
            {
                context.Builder.WithSettings(new HtmlBodyPartSettings {
                    Editor = model.Editor
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }