Beispiel #1
0
        // GET: News

        public ActionResult Index2()
        {
            var xiaoxi            = NewsManage.FindAllNews().OrderByDescending(p => p.SubmtDate).Take(6);
            var CountryNews       = NewsManage.FindCountryNews().Where(p => p.Section_id == 1).Take(16);
            var InternationalNews = NewsManage.FindInternationalNews().Where(p => p.Section_id == 2).Take(16);
            var HotNews           = NewsManage.FindHotNews().Where(p => p.Section_id == 3).Take(16);

            ViewModels.Cnpagelist index = new ViewModels.Cnpagelist();
            index.Findcountrynews       = CountryNews;
            index.FindAllNews           = xiaoxi;
            index.FindInternationalNews = InternationalNews;
            index.FindHotNews           = HotNews;
            return(View(index));
        }
Beispiel #2
0
        public ActionResult Detail(int id)
        {
            var detail  = NewsManage.FindDetailNews(id);
            var commend = CommentNewsManage.FindAllComment(id);
            var pre     = NewsManage.FindPreNews(id);

            if (pre == null)
            {
                return(Content("<script>;alert('到顶了!');</script>"));
            }
            var next = NewsManage.FindNextNews(id);

            if (next == null)
            {
                return(Content("<script>;alert('到底了!');</script>"));
            }
            ViewBag.coutcommend = CommentNewsManage.Countmiti(id);
            ViewModels.Cnpagelist index = new ViewModels.Cnpagelist();
            index.FindDetailNews = detail;
            index.FindPreNews    = pre;
            index.FindNextNews   = next;
            index.FindAllComment = commend;
            return(View(index));
        }