Exemplo n.º 1
0
        //
        // Build list for home page
        public ActionResult BuildHomePageList()
        {
            PromoListModel model = null;

            IPublishedContent list = null;
            int    promoListContentId;
            string promoListContentIdString = System.Configuration.ConfigurationManager.AppSettings["promoListContentId"];

            if (!string.IsNullOrWhiteSpace(promoListContentIdString) && Int32.TryParse(promoListContentIdString, out promoListContentId))
            {
                list = Umbraco.TypedContent(promoListContentId);
            }

            if (list != null)
            {
                model = PromoListMapper.MapForHomePage(list);// we only want to pull the promo items that are flagged for homepage inclusion

                if (String.IsNullOrEmpty(model.ListTitle))
                {
                    model.ListTitle = "Bluegreen Promotions";
                }
            }

            return(PartialView("PromoColumn", model));
        }
Exemplo n.º 2
0
        public ActionResult GetPartialView()
        {
            var salesTypeCode = GetSalesTypeCode((BGO.OwnerWS.Owner)Session["BXGOwner"]);

            NewsListModel newsList = new NewsListModel();
            int           newsListContentId;
            string        newsListContentIdString = ConfigurationManager.AppSettings["newsListContentId"];

            if (!string.IsNullOrWhiteSpace(newsListContentIdString) && Int32.TryParse(newsListContentIdString, out newsListContentId))
            {
                var content = Umbraco.Content(newsListContentId);
                if (content.GetType() != typeof(DynamicNull))
                {
                    newsList = NewsListMapper.MapForHomePage(content, salesTypeCode);
                }
            }

            PromoListModel promoList = new PromoListModel();
            int            promoListContentId;
            string         promoListContentIdString = ConfigurationManager.AppSettings["promoListContentId"];

            if (!string.IsNullOrWhiteSpace(promoListContentIdString) && Int32.TryParse(promoListContentIdString, out promoListContentId))
            {
                var content = Umbraco.Content(promoListContentId);
                if (content.GetType() != typeof(DynamicNull))
                {
                    promoList = PromoListMapper.MapForHomePage(content, salesTypeCode);
                }
            }

            var newsItemCount  = newsList.NewsItems.Count;
            var promoItemCount = promoList.PromoItems.Count;
            var numTotalItems  = newsItemCount + promoItemCount;

            var model      = new NewsSliderModel();
            int newsIndex  = 0;
            int promoIndex = 0;

            while (newsIndex < newsItemCount || promoIndex < promoItemCount)
            {
                if (newsIndex < newsItemCount)
                {
                    model.NewsAndPromoList.Add(newsList.NewsItems[newsIndex]);
                    newsIndex++;
                }

                if (promoIndex < promoItemCount)
                {
                    model.NewsAndPromoList.Add(promoList.PromoItems[promoIndex]);
                    promoIndex++;
                }
            }

            return(PartialView("NewsSlider", model));
        }