// GET: CartCourse public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var khoaHocDao = new KhoaHocDao(); var model = khoaHocDao.ListAllPaging(searchString, page, pageSize); ViewBag.Search = searchString; return(View(model)); //var cart = Session[CartSession]; //var list = new List<CartCourse>(); //if(cart != null) //{ // list = (List<CartCourse>)cart; //} //return View(list); }
// GET: KhoaHoc public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { eCenterDbContext _context = new eCenterDbContext(); ViewBag.TongKhoaHoc = _context.KhoaHocs.Count(); // Khóa học còn chỗ ViewBag.KhoaHocConCho = _context.KhoaHocs.Where(x => x.SoLuong > 0).Count(); // Khóa học hết chỗ ViewBag.KhoaHocHetCho = _context.KhoaHocs.Where(x => x.SoLuong == 0).Count(); var _khoaHocDao = new KhoaHocDao(); var _modelKhoaHoc = _khoaHocDao.ListAllPaging(searchString, page, pageSize); ViewBag.SoLuongCon = _khoaHocDao.CountQuantityRemaining(); ViewBag.SearchString = searchString; return(View(_modelKhoaHoc)); }