// GET: Admin/Content public ActionResult Index(string searchString, int?page, int pageSize = 10) { var currentPage = page ?? 1; var contentDao = new ContentDao(); var model = contentDao.GetAllContent(searchString, currentPage, pageSize); ViewBag.searchString = searchString; return(View(model)); }
// GET: Content public ActionResult Index(int?page, int pageSize = 10) { var currentPage = page ?? 1; var contentDao = new ContentDao(); var model = contentDao.GetAllContent(currentPage, pageSize); int totalRecord = 0; ViewBag.TotalRecord = totalRecord; ViewBag.Page = page; ViewBag.MaxPage = 5; var totalPage = (int)Math.Ceiling((double)(totalRecord / pageSize)); ViewBag.TotalPage = totalPage; ViewBag.First = 1; ViewBag.Last = totalPage; ViewBag.NextPage = page + 1; ViewBag.PreviousPage = page - 1; return(View(model)); }