public override void UpdateFieldSettings(string fieldType, string fieldName, SettingsDictionary settingsDictionary, IUpdateModel updateModel) {
     if (fieldType != "NumberField") {
         return;
     }
     var model = new NumberFieldSettings();
     if (updateModel.TryUpdateModel(model, "NumberFieldSettings", null, null)) {
         UpdateSettings(model, settingsDictionary, "NumberFieldSettings");
         settingsDictionary["NumberFieldSettings.Length"] = model.Length.ToString("D");
         settingsDictionary["NumberFieldSettings.DecimalPlaces"] = model.DecimalPlaces.ToString("D");
         settingsDictionary["NumberFieldSettings.DefaultValue"] = model.DefaultValue.ToString();
     }
 }
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.FieldType != "NumberField") {
                yield break;
            }

            var model = new NumberFieldSettings();
            if (updateModel.TryUpdateModel(model, "NumberFieldSettings", null, null)) {
                UpdateSettings(model, builder, "NumberFieldSettings");
                builder.WithSetting("NumberFieldSettings.Length", model.Length.ToString());
                builder.WithSetting("NumberFieldSettings.DecimalPlaces", model.DecimalPlaces.ToString());
                builder.WithSetting("NumberFieldSettings.DefaultValue", model.DefaultValue.ToString());
            }

            yield return DefinitionTemplate(model);
        }
Exemple #3
0
        public override void UpdateFieldSettings(string fieldType, string fieldName, SettingsDictionary settingsDictionary, IUpdateModel updateModel)
        {
            if (fieldType != "NumberField")
            {
                return;
            }
            var model = new NumberFieldSettings();

            if (updateModel.TryUpdateModel(model, "NumberFieldSettings", null, null))
            {
                UpdateSettings(model, settingsDictionary, "NumberFieldSettings");
                settingsDictionary["NumberFieldSettings.Length"]        = model.Length.ToString("D");
                settingsDictionary["NumberFieldSettings.DecimalPlaces"] = model.DecimalPlaces.ToString("D");
                settingsDictionary["NumberFieldSettings.DefaultValue"]  = model.DefaultValue.ToString();
            }
        }