public ActionResult Catalog(CatalogSettingsModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } //load settings for a chosen store scope var catalogSettings = _settingService.LoadSetting <CatalogSettings>(); catalogSettings = model.ToEntity(catalogSettings); /* 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.SaveSetting(catalogSettings); //now clear settings cache _settingService.ClearCache(); //activity log _customerActivityService.InsertActivity("EditSettings", _localizationService.GetResource("ActivityLog.EditSettings")); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Updated")); //selected tab SaveSelectedTabIndex(); return(RedirectToAction("Catalog")); }
public async Task <IActionResult> Catalog(CatalogSettings catalogSettings, CatalogSettingsModel model) { if (!ModelState.IsValid) { return(View(model)); } ModelState.Clear(); // We need to clear the sitemap cache if MaxItemsToDisplayInCatalogMenu has changed. if (catalogSettings.MaxItemsToDisplayInCatalogMenu != model.MaxItemsToDisplayInCatalogMenu) { // Clear cached navigation model. await _menuService.Value.ClearCacheAsync("Main"); } await MapperFactory.MapAsync(model, catalogSettings); return(NotifyAndRedirect("Catalog")); }
protected virtual void PrepareAllCategoriesModel(CatalogSettingsModel model) { if (model == null) { throw new ArgumentNullException("model"); } model.AvailableCategories.Add(new SelectListItem { Text = "[None]", Value = "0" }); var categories = _categoryService.GetAllCategories(showHidden: true); foreach (var c in categories) { model.AvailableCategories.Add(new SelectListItem { Text = c.GetFormattedBreadCrumb(categories), Value = c.Id.ToString() }); } }
public IActionResult SaveSettings(CatalogSettingsModel catalogSettings) { SaveSetting(catalogSettings); return(R.Success.Result); }
public static CatalogSettings ToEntity(this CatalogSettingsModel model, CatalogSettings destination) { return(model.MapTo(destination)); }
public static CatalogSettings ToEntity(this CatalogSettingsModel model, CatalogSettings destination) { return(Mapper.Map(model, destination)); }
public static CatalogSettings ToEntity(this CatalogSettingsModel model) { return(Mapper.Map <CatalogSettingsModel, CatalogSettings>(model)); }
public static CatalogSettings ToEntity(this CatalogSettingsModel model, CatalogSettings entity) { MapperFactory.Map(model, entity); return(entity); }