public IActionResult Configure(SAPConfigureModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins)) { return(AccessDeniedView()); } //load settings for a chosen store scope var storeScope = _storeContext.ActiveStoreScopeConfiguration; var sapSettings = _settingService.LoadSetting <SAPSettings>(storeScope); sapSettings.SapAPI = model.SapAPI; sapSettings.UserId = model.UserId; sapSettings.Password = model.Password; /* We do not clear cache after each setting update. * This behavior can increase performance because cached settings will not be cleared * and loaded from database after each update */ _settingService.SaveSettingOverridablePerStore(sapSettings, x => x.SapAPI, model.SapAPI_OverrideForStore, storeScope, false); _settingService.SaveSettingOverridablePerStore(sapSettings, x => x.UserId, model.UserId_OverrideForStore, storeScope, false); _settingService.SaveSettingOverridablePerStore(sapSettings, x => x.Password, model.Password_OverrideForStore, storeScope, false); //now clear settings cache _settingService.ClearCache(); _notificationService.SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved")); return(Configure()); }
public IActionResult Configure() { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins)) { return(AccessDeniedView()); } //load settings for a chosen store scope var storeScope = _storeContext.ActiveStoreScopeConfiguration; var sapSettings = _settingService.LoadSetting <SAPSettings>(storeScope); var model = new SAPConfigureModel { SapAPI = sapSettings.SapAPI, UserId = sapSettings.UserId, Password = sapSettings.Password, ActiveStoreScopeConfiguration = storeScope }; if (storeScope > 0) { model.SapAPI_OverrideForStore = _settingService.SettingExists(sapSettings, x => x.SapAPI, storeScope); model.UserId_OverrideForStore = _settingService.SettingExists(sapSettings, x => x.UserId, storeScope); model.Password_OverrideForStore = _settingService.SettingExists(sapSettings, x => x.Password, storeScope); } return(View(model)); }