public ActionResult Media(MediaSettingsModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } //load settings for a chosen store scope var mediaSettings = _settingService.LoadSetting <MediaSettings>(); mediaSettings = model.ToEntity(mediaSettings); _settingService.SaveSetting(mediaSettings); //now clear settings cache _settingService.ClearCache(); //activity log _customerActivityService.InsertActivity("EditSettings", _localizationService.GetResource("ActivityLog.EditSettings")); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Updated")); return(RedirectToAction("Media")); }
public ActionResult Media(MediaSettingsModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var mediaSettings = _settingService.LoadSetting <MediaSettings>(storeScope); mediaSettings = model.ToEntity(mediaSettings); if (model.AvatarPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.AvatarPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.AvatarPictureSize, storeScope); } if (model.ProductThumbPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.ProductThumbPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.ProductThumbPictureSize, storeScope); } if (model.ProductDetailsPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.ProductDetailsPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.ProductDetailsPictureSize, storeScope); } if (model.ProductThumbPictureSizeOnProductDetailsPage_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.ProductThumbPictureSizeOnProductDetailsPage, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.ProductThumbPictureSizeOnProductDetailsPage, storeScope); } if (model.AssociatedProductPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.AssociatedProductPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.AssociatedProductPictureSize, storeScope); } if (model.CategoryThumbPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.CategoryThumbPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.CategoryThumbPictureSize, storeScope); } if (model.ManufacturerThumbPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.ManufacturerThumbPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.ManufacturerThumbPictureSize, storeScope); } if (model.CartThumbPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.CartThumbPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.CartThumbPictureSize, storeScope); } if (model.MiniCartThumbPictureSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.MiniCartThumbPictureSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.MiniCartThumbPictureSize, storeScope); } if (model.MaximumImageSize_OverrideForStore || storeScope == 0) { _settingService.SaveSetting(mediaSettings, x => x.MaximumImageSize, storeScope, false); } else if (storeScope > 0) { _settingService.DeleteSetting(mediaSettings, x => x.MaximumImageSize, storeScope); } _settingService.ClearCache(); _customerActivityService.InsertActivity("EditSettings", _localizationService.GetResource("ActivityLog.EditSettings")); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Updated")); return(RedirectToAction("Media")); }