/// <summary> /// 所有课程信息 /// </summary> /// <returns></returns> public ActionResult AllCoursePage(int pageIndex, string key, string value) { ViewBag.CourseKey = key; //搜索条件 ViewBag.SearchValue = value; //搜索的值 CourseBLL courseBLL = new CourseBLL(); int PageSize = 8; //页容量 int TotalCount = courseBLL.GetDataCount(key, value); //数据总量 int TotalPages = (int)Math.Ceiling(TotalCount / (double)PageSize); //分页张数 int PageIndex = pageIndex; //页面索引 if (PageIndex >= TotalPages) { PageIndex = TotalPages - 1; } if (PageIndex < 0) { PageIndex = 0; } PagePading(PageSize, TotalCount, TotalPages, PageIndex);// 分页 DataTable table = courseBLL.GetCourseQuery(PageIndex, PageSize, key, value); return(View(table)); }