Exemplo n.º 1
0
        public ActionResult Index()
        {
            DataModel       dataModel = new DataModel();
            List <NewsItem> newsItems = NewsItems.GetFrontNewsItems(30);

            dataModel.FirstNewsItem  = newsItems[0];
            dataModel.SecondNewsItem = newsItems[1];
            dataModel.ThirdNewsItem  = newsItems[2];
            dataModel.FourthNewsItem = newsItems[3];
            dataModel.FifthNewsItem  = newsItems[4];
            dataModel.NewsItems      = new List <NewsItem>();
            foreach (NewsItem newsItem in newsItems)
            {
                if (newsItem.ItemState == ItemState.Enabled)
                {
                    dataModel.NewsItems.Add(newsItem);
                }
            }

            return(View(dataModel));
        }