public ActionResult Index(int?size, int?page, string searchString) { ViewBag.CurrentFilter = searchString; var roleStaff = RoleManager.Roles.FirstOrDefault(x => x.Name == "Staff"); var lstUserId = _repoUser.FindAll(x => x.RoleId == roleStaff.Id).Select(x => x.UserId).ToList(); var lstUser = UserManager.Users.Where(x => lstUserId.Any(p => p.Contains(x.Id))).ToList(); var roleStudent = RoleManager.Roles.FirstOrDefault(x => x.Name == "Student"); //total staff ViewBag.CountStaff = lstUserId.Count(); //total student ViewBag.CountStudent = _repoUser.FindAll(x => x.RoleId == roleStudent.Id).Count(); //total competition ViewBag.CountCompetition = _repoCompetition.Count(); //total post ViewBag.CountPost = _repoPost.Count(); ViewBag.stt = 1; ViewBag.currentSize = size; // tạo biến kích thước trang hiện tại ViewBag.total = lstUser.Count; page = page ?? 1; int pageSize = (size ?? 8); int pageNumber = (page ?? 1); return(View(lstUser.ToPagedList(pageNumber, pageSize))); }