Пример #1
0
        public void AssignProductsForCampaign(List<String> assignProducts)
        {
            List<Guid> productIds = assignProducts.Select(Guid.Parse).ToList();
            var productCampaigns = (PriceByProductCampaignModel)CampaignModelHelper.ModelHelper.ConcreteCampaign.Model ??
                new PriceByProductCampaignModel();

            foreach (Guid id in productIds)
            {
                var product = Repository.Data.Get<Product>(id);
                var productCampaign = new PriceByProductCampaignItemModel
                {
                    Id = product.Id,
                    Name = product.Name,
                    Price = product.Price
                };
                productCampaigns.Add(productCampaign);
            }

            CampaignModelHelper.ModelHelper.ConcreteCampaign.Model = productCampaigns;
        }
Пример #2
0
        public ActionResult SavePriceByProductCampaign()
        {
            var campaignModel = new PriceByProductCampaignItemModel();

            if (TryUpdateModel(campaignModel))
            {
                var model = CampaignModelHelper.ModelHelper.ConcreteCampaign.Model as PriceByProductCampaignModel;
                model.Remove(campaignModel);
                model.Add(campaignModel);
                CampaignModelHelper.ModelHelper.ConcreteCampaign.Model = model;
            }

            return View("CampaignPartial/PriceByProductCampaign", GetPriceCampaignGridModel());
        }