public ActionResult BannerDelete(PromoBannerModel bannerModel)
        {
            if (bannerModel == null)
            {
                ModelState.AddModelError(string.Empty, _localizationService.GetResource("Plugins.Widgets.QixolPromo.Banner.ValidationMsg.Delete"));
                return Json(new DataSourceResult { Errors = ModelState.SerializeErrors() });
            }

            if (bannerModel.Id == 0)
            {
                ModelState.AddModelError(string.Empty, _localizationService.GetResource("Plugins.Widgets.QixolPromo.Banner.ValidationMsg.Delete"));
                return Json(new DataSourceResult { Errors = ModelState.SerializeErrors() });
            }

            var bannerItem = _promoBannerService.RetrieveBannerById(bannerModel.Id);
            if (bannerItem == null)
            {
                ModelState.AddModelError(string.Empty, _localizationService.GetResource("Plugins.Widgets.QixolPromo.Banner.ValidationMsg.Delete"));
                return Json(new DataSourceResult { Errors = ModelState.SerializeErrors() });
            }

            _promoBannerService.DeleteBanner(bannerItem);

            return new NullJsonResult();
        }
 public WidgetConfigModel()
 {
     AddPictureModel = new PromoAddPictureModel();
     AddPromoBannerModel = new PromoBannerModel();
     ProductPagePromoDetailsWidgetZonesList = new List<SelectListItem>();
 }
        public ActionResult BannerEdit(PromoBannerModel bannerModel)
        {
            if ((bannerModel == null)
                || (bannerModel.Id == 0)
                || (string.IsNullOrEmpty(bannerModel.Name)))
            {
                ModelState.AddModelError(string.Empty, _localizationService.GetResource("Plugins.Widgets.QixolPromo.Banner.ValidationMsg.Edit"));
                return Json(new DataSourceResult { Errors = ModelState.SerializeErrors() });
            }

            var bannerItem = _promoBannerService.RetrieveBannerById(bannerModel.Id);
            if (bannerItem == null)
            {
                ModelState.AddModelError(string.Empty, _localizationService.GetResource("Plugins.Widgets.QixolPromo.Banner.ValidationMsg.Edit"));
                return Json(new DataSourceResult { Errors = ModelState.SerializeErrors() });
            }

            bannerItem.Name = bannerModel.Name;
            bannerItem.Enabled = bannerModel.Enabled;
            bannerItem.TransitionType = bannerModel.TransitionType;

            _promoBannerService.UpdateBanner(bannerItem);
            return new NullJsonResult();
        }