Esempio n. 1
0
 public ActionResult Info_Index()
 {
     ViewBag.infos   = InfoBll.GetAll().OrderBy(u => u.Info_ID).Take(4);
     ViewBag.videos  = videoBll.GetAll().OrderBy(u => u.Video_ID).Take(3);
     ViewBag.info1   = InfoBll.GetAll().OrderBy(u => u.Info_ID).FirstOrDefault();
     ViewBag.info2   = InfoBll.GetAll().OrderBy(u => u.Info_ID).Take(5);
     ViewBag.comment = InfoCommentBll.GetAll().OrderBy(u => u.Info_ID).Take(3);
     foreach (var item in ViewBag.comment)
     {
         int id = Convert.ToInt32(item.UserInfo_ID);
         ViewBag.userinfo = UserInfoBll.GetAll().Where(u => u.UserInfo_ID == id).FirstOrDefault();
     }
     return(View());
 }
Esempio n. 2
0
        public ActionResult VideoIndex(int?id, int pageIndex = 1)
        {
            ViewBag.videoClassModel = videoClassBll.GetAll();
            ViewBag.videoinfo       = videoBll.GetAll().OrderBy(u => u.Video_ID).Take(6);
            var Videos = from a in  videoBll.GetAll()
                         select  new VideoModel {
                Video_ID      = a.Video_ID,
                Video_Title   = a.Video_Title,
                Video_Img     = a.Video_Img,
                VideoClass_ID = a.VideoClass_ID,
                Video_Url     = a.Video_Url
            };

            if (id != null)
            {
                Videos = Videos.Where(u => u.VideoClass_ID == id);
            }
            ViewBag.Videos = Videos;
            var videoClasses = videoClassBll.GetAll();
            PagingHelper <VideoModel> StudentPaging = new PagingHelper <VideoModel>(3, Videos); //初始化分页器

            StudentPaging.PageIndex = pageIndex;                                                //指定当前页
            return(View(StudentPaging));                                                        //返回分页器实例到视图
        }