Пример #1
0
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new ImageFieldSettings();
            if(updateModel.TryUpdateModel(model, "ImageFieldSettings", null, null)) {
                builder.WithSetting("ImageFieldSettings.Hint", model.Hint);
                builder.WithSetting("ImageFieldSettings.MaxHeight", model.MaxHeight.ToString());
                builder.WithSetting("ImageFieldSettings.MaxWidth", model.MaxWidth.ToString());
                builder.WithSetting("ImageFieldSettings.Required", model.Required.ToString());
                builder.WithSetting("ImageFieldSettings.MediaFolder", model.MediaFolder);
                builder.WithSetting("ImageFieldSettings.FileName", model.FileName);
                builder.WithSetting("ImageFieldSettings.AlternateText", model.AlternateText.ToString());
                builder.WithSetting("ImageFieldSettings.ResizeAction", model.ResizeAction.ToString());
            }

            yield return DefinitionTemplate(model);
        }
Пример #2
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var model = new ImageFieldSettings();

            if (updateModel.TryUpdateModel(model, "ImageFieldSettings", null, null))
            {
                builder.WithSetting("ImageFieldSettings.Hint", model.Hint);
                builder.WithSetting("ImageFieldSettings.MaxHeight", model.MaxHeight.ToString());
                builder.WithSetting("ImageFieldSettings.MaxWidth", model.MaxWidth.ToString());
                builder.WithSetting("ImageFieldSettings.Required", model.Required.ToString());
                builder.WithSetting("ImageFieldSettings.MediaFolder", model.MediaFolder);
                builder.WithSetting("ImageFieldSettings.FileName", model.FileName);
                builder.WithSetting("ImageFieldSettings.AlternateText", model.AlternateText.ToString());
                builder.WithSetting("ImageFieldSettings.ResizeAction", model.ResizeAction.ToString());
            }

            yield return(DefinitionTemplate(model));
        }