public ActionResult Sanpham_hang(string metatitle, string hang, int page = 1, int pageSize = 9) { var newdao = new NewDao(); var menu = new MenuDao(); ViewBag.header = menu.header_hang(metatitle, hang); int totalRecord_hang = 0; var ListALL = newdao.sanPH_sp_hang(metatitle, hang, ref totalRecord_hang, page, pageSize); ViewBag.Total = totalRecord_hang; ViewBag.Page = page; int maxPage = 5; int totalPage = 0; totalPage = (int)Math.Ceiling((double)(totalRecord_hang / pageSize)); ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Last = totalPage; ViewBag.Next = page + 1; ViewBag.Prev = page - 1; return(View(ListALL)); }