// GET: Admin/Menu public ActionResult Index(int page = 1, int pageSize = 10) { var dao = new MenuDao(); var model = dao.ListAllPaging(page, pageSize); return(View(model)); }
// GET: Admin/Menu public ActionResult Index(string searchString, int page = 1, int pageSize = 5) { var dao = new MenuDao(); var model = dao.ListAllPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
// GET: Admin/Menu public ActionResult Index(string searchString, int page = 1, int pageSize = 5) { var dao = new MenuDao(); var model = dao.ListAllPaging(searchString, page, pageSize); int totalRecord = dao.TotalMenu(searchString); double dblPageCount = (double)((decimal)totalRecord / Convert.ToDecimal(pageSize)); int totalPage = (int)Math.Ceiling(dblPageCount); int startRecord = (page - 1) * pageSize + 1; int endRecord = 0; if (page == totalPage) { endRecord = totalRecord; } else { endRecord = startRecord + pageSize - 1; } if (totalRecord < 5) { if (totalRecord == 0) { startRecord = 0; endRecord = 0; } else { startRecord = 1; endRecord = totalRecord; } } ViewBag.startRecord = startRecord; ViewBag.endRecord = endRecord; ViewBag.totalRecord = totalRecord; ViewBag.searchString = searchString; return(View(model)); }