public ActionResult Listing(string search, string roleID, int?page) { page = page ?? 1; //viewModel var viewModel = new UsersListingModel(); //fetching Users var users = UserManager.Users; if (!string.IsNullOrEmpty(search)) { users = users.Where(u => u.Email.Contains(search)); } if (!string.IsNullOrEmpty(roleID)) { users = users.Where(u => u.Roles.Select(x => x.RoleId).Contains(roleID)); } viewModel.Pager = new PagerViewModel(users.Count(), page, 3); var skip = (page.Value - 1) * 3; // 3 is the records to skip.. viewModel.Users = users.OrderBy(u => u.Email).Skip(skip).Take(3).ToList(); return(PartialView("_Listing", viewModel)); }
public async Task <ActionResult> Index(string searchTerm, string roleID, int?page) { int recordSize = 10; page = page ?? 1; UsersListingModel model = new UsersListingModel(); model.SearchTerm = searchTerm; model.RoleID = roleID; model.Roles = RoleManager.Roles.ToList(); model.Users = await SearchUsers(searchTerm, roleID, page.Value, recordSize); var totalRecords = await SearchUsersCount(searchTerm, roleID); model.Pager = new Pager(totalRecords, page, recordSize); return(View(model)); }
public ActionResult Index() { //viewModel var viewModel = new UsersListingModel(); //fetching Roles var roles = RoleManager.Roles; viewModel.UserRoles = roles.ToList(); return(View(viewModel)); }
public ActionResult Index(string searchTerm, string?roleID, int?page) { UsersListingModel model = new UsersListingModel(); model.SearchTerm = searchTerm; model.RoleID = roleID; //model.Roles = accomodationPackagesService.GetAllAccomodationPackages(); //model.Users = accomodationsService.SearchAccomodations(searchTerm, roleID); return(View(model)); }
public ActionResult Index(string searchTerm, int?page, string roleID) { int recordSize = 3; page = page ?? 1; UsersListingModel model = new UsersListingModel(); model.SearchTerm = searchTerm; model.RoleID = roleID; model.Roles = RoleManager.Roles.AsQueryable(); model.UsersCount = SearchUsersCount(searchTerm, roleID); model.Users = SearchUsers(searchTerm, roleID, recordSize, page.Value); model.Pager = new Pager(model.UsersCount, page, recordSize); return(View(model)); }
// GET: Dashboard/Accommodations public async Task <ActionResult> Index(string searchTerm, string roleId, int?page) { UsersListingModel model = new UsersListingModel(); page = page ?? 1; var pageSize = 10; var totalRecords = await GetAllUsersCount(searchTerm, roleId); model.Users = await SearchUsers(searchTerm, roleId, page.Value, pageSize); model.SearchByName = searchTerm; model.SearchByRoleId = roleId; model.Roles = RoleManager.Roles.ToList(); model.Pager = new Pager(totalRecords, page, pageSize); return(View(model)); }
// GET: Dashboard/Users public ActionResult Index(string searchTerm, string roleID, int?pageNo) { int recordSize = 9; pageNo = pageNo ?? 1; UsersListingModel model = new UsersListingModel(); model.SearchTerm = searchTerm; model.RoleID = roleID; model.Roles = RoleManager.Roles.ToList(); model.Users = SearchUsers(searchTerm, roleID, pageNo.Value, recordSize); var totalRecord = SearchUsersCount(searchTerm, roleID); model.Pager = new Pager(totalRecord, pageNo, recordSize); return(View(model)); }