Beispiel #1
0
        public IActionResult SaveSynchronization(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            var storeId            = _storeContext.ActiveStoreScopeConfiguration;
            var sendInBlueSettings = _settingService.LoadSetting <SendinBlueSettings>(storeId);

            //create webhook for the unsubscribe event
            sendInBlueSettings.UnsubscribeWebhookId = _sendInBlueEmailManager.GetUnsubscribeWebHookId();
            _settingService.SaveSetting(sendInBlueSettings, x => x.UnsubscribeWebhookId, clearCache: false);

            //set list of contacts to synchronize
            sendInBlueSettings.ListId = model.ListId;
            _settingService.SaveSettingOverridablePerStore(sendInBlueSettings, x => x.ListId, model.ListId_OverrideForStore, storeId, false);

            //now clear settings cache
            _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            //select "synchronization" tab
            SaveSelectedTabName("tab-synchronization");

            return(Configure());
        }