public static void SetValues(ContentTypePartDefinitionBuilder builder, GDPRPartTypeSettings settings)
 {
     builder.WithSetting(
         "GDPRPartTypeSettings.IsProfileItemType",
         settings.IsProfileItemType.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "GDPRPartTypeSettings.DeleteItemsAfterErasure",
         settings.DeleteItemsAfterErasure.ToString(CultureInfo.InvariantCulture));
 }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            // working on GDPRPart
            if (builder.Name != "GDPRPart")
            {
                yield break;
            }

            var vm = new GDPRPartTypeSettingsViewModel();

            if (updateModel.TryUpdateModel(vm, "GDPRPartTypeSettingsViewModel", null, null))
            {
                var settings = vm.Settings;
                GDPRPartTypeSettings.SetValues(builder, settings);
            }
        }
 /// <summary>
 /// Create a ViewModel based on the settings provided. This method is really simple to begin
 /// with, to the point where it's not even really needed, but I create it already so that when
 /// the model becomes more complex I don't have to refactor code.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 private GDPRPartTypeSettingsViewModel MakeViewModel(GDPRPartTypeSettings settings)
 {
     return(new GDPRPartTypeSettingsViewModel {
         Settings = settings
     });
 }