// GET: SanPham public ActionResult Index(int cateId, int page = 1, int pageSize = 9) { var newdao = new NewDao(); var menu = new MenuDao(); ViewBag.header = menu.header(cateId); int totalRecord3 = 0; var ListALL = newdao.sanP_sp(cateId, ref totalRecord3, page, pageSize); ViewBag.Total = totalRecord3; ViewBag.Page = page; int maxPage = 5; int totalPage = 0; totalPage = (int)Math.Ceiling((double)(totalRecord3 / pageSize)); ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Last = totalPage; ViewBag.Next = page + 1; ViewBag.Prev = page - 1; return(View(ListALL)); }