示例#1
0
        public ActionResult Index()
        {
            AppFunctions apf = new AppFunctions();

            ViewBag.HeadLine1   = AppFunctions.GetNewsArticleData("ArticleHeadline", AppFunctions.GetLatestArticleIds(0));
            ViewBag.HeadLine1ID = AppFunctions.GetLatestArticleIds(0).ToString();
            //
            ViewBag.HeadLine2   = AppFunctions.GetNewsArticleData("ArticleHeadline", AppFunctions.GetLatestArticleIds(1));
            ViewBag.HeadLine2ID = AppFunctions.GetLatestArticleIds(1).ToString();
            //
            ViewBag.HeadLine3   = AppFunctions.GetNewsArticleData("ArticleHeadline", AppFunctions.GetLatestArticleIds(2));
            ViewBag.HeadLine3ID = AppFunctions.GetLatestArticleIds(2).ToString();
            //
            ViewBag.HeadLine4   = AppFunctions.GetNewsArticleData("ArticleHeadline", AppFunctions.GetLatestArticleIds(3));
            ViewBag.HeadLine4ID = AppFunctions.GetLatestArticleIds(3).ToString();
            //
            ViewBag.HeadLine5   = AppFunctions.GetNewsArticleData("ArticleHeadline", AppFunctions.GetLatestArticleIds(4));
            ViewBag.HeadLine5ID = AppFunctions.GetLatestArticleIds(4).ToString();
            //
            ViewBag.HeadLine6   = AppFunctions.GetNewsArticleData("ArticleHeadline", AppFunctions.GetLatestArticleIds(5));
            ViewBag.HeadLine6ID = AppFunctions.GetLatestArticleIds(5).ToString();

            ViewBag.ShowData = true;
            if (db.NewsArticles.Count(s => s.ReviewStatus == 1 && s.DeleteStatus != true) < 6)
            {
                ViewBag.ShowData = false;
            }

            var data = db.NewsArticles.Where(s => s.ReviewStatus == 1 && s.DeleteStatus != true);

            return(View(data));
            //var data = db.Posts.Where(s => s.ReviewStatus == 1 && s.DeleteStatus != true);
            //return View(db.Posts.ToList());
        }