Exemple #1
0
        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"));
        }
Exemple #2
0
        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"));
        }
Exemple #3
0
        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()
                });
            }
        }
Exemple #4
0
 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));
 }
Exemple #8
0
 public static CatalogSettings ToEntity(this CatalogSettingsModel model, CatalogSettings entity)
 {
     MapperFactory.Map(model, entity);
     return(entity);
 }