public ActionResult ForPassed() { LearnMyCourseBLL bll = new LearnMyCourseBLL(); Code.SiteCache cache = Code.SiteCache.Instance; int accountId = cache.LoginInfo.UserId; int partitionId = cache.LoginInfo.PartitionId; int recordCount = bll.GetMyCourseCount(accountId, partitionId, "1,2"); int pageSize = 8, pageIndex; int pageCount = (int)Math.Ceiling((double)recordCount / pageSize); int.TryParse(Request["PageIndex"], out pageIndex); if (pageCount == 0) { pageIndex = 0; } else { if (pageIndex < 1) pageIndex = 1; else if (pageIndex > pageCount) pageIndex = pageCount; } ViewBag.RecordCount = recordCount; ViewBag.PageCount = pageCount; ViewBag.PageIndex = pageIndex; ViewBag.PageSize = pageSize; return View(bll.GetMyCourseList(pageSize, pageIndex, "A.Id desc", accountId, partitionId, "1,2")); }