Exemplo n.º 1
0
        public ActionResult Promotion()
        {
            var datasource = CurrentRendering.DataSource;
            var datasourceItem = Context.Database.GetItem(ID.Parse(datasource));
            var commercePromotion = new CommercePromotion(datasourceItem);

            return View(CurrentRenderingView, commercePromotion);
        }
Exemplo n.º 2
0
        public ActionResult PromoRotator()
        {
            var datasource = CurrentRendering.DataSource;
            var datasourceItem = Context.Database.GetItem(ID.Parse(datasource));

            var item = Context.Item;
            var associatedItemIds = datasourceItem["Promotions"];
            var associatedItemIdArray = associatedItemIds.Split("|".ToCharArray());

            var viewModel = new PromoRotator(item);

            foreach (var associatedItemId in associatedItemIdArray)
            {
                if (!string.IsNullOrEmpty(associatedItemId))
                {
                    var associatedItem = Context.Database.GetItem(ID.Parse(associatedItemId));
                    var commercePromotion = new CommercePromotion(associatedItem);
                    viewModel.Promotions.Add(commercePromotion);
                }
            }

            return View(CurrentRenderingView, viewModel);
        }