Exemple #1
0
        //
        // Build list for home page
        public ActionResult BuildHomePageList()
        {
            NewsListModel model = null;

            dynamic list = null;
            int     newsListContentId;
            string  newsListContentIdString = System.Configuration.ConfigurationManager.AppSettings["newsListContentId"];

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

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

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

            return(PartialView("NewsColumn", model));
        }
Exemple #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));
        }