public ActionResult Configure(Zbozi.Models.ZboziFeedModel model) { if (!ModelState.IsValid) { return(Configure()); } //save settings _zboziSettings.ProductPictureSize = model.ProductPictureSize; _zboziSettings.PassShippingInfoWeight = model.PassShippingInfoWeight; _zboziSettings.PassShippingInfo = model.PassShippingInfo; _zboziSettings.PricesConsiderPromotions = model.PricesConsiderPromotions; _zboziSettings.CurrencyId = model.CurrencyId; _zboziSettings.StoreId = model.StoreId; _zboziSettings.DefaultDeliveryDate = model.DefaultDeliveryDate; _zboziSettings.DefaultGoogleCategory = model.DefaultGoogleCategory; _settingService.SaveSetting(_zboziSettings); SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved")); //redisplay the form return(Configure()); }
public ActionResult GenerateFeed(Zbozi.Models.ZboziFeedModel model) { try { var pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName("ProductFeed.Zbozi"); if (pluginDescriptor == null) { throw new Exception("Cannot load the plugin"); } //plugin var plugin = pluginDescriptor.Instance() as ZboziShoppingService; if (plugin == null) { throw new Exception("Cannot load the plugin"); } var stores = new List <Store>(); var storeById = _storeService.GetStoreById(_zboziSettings.StoreId); if (storeById != null) { stores.Add(storeById); } else { stores.AddRange(_storeService.GetAllStores()); } foreach (var store in stores) { plugin.GenerateStaticFile(store); } SuccessNotification(_localizationService.GetResource("Plugins.Feed.Zbozi.SuccessResult")); } catch (Exception exc) { ErrorNotification(exc.Message); _logger.Error(exc.Message, exc); } return(Configure()); }