Beispiel #1
0
		public ActionResult ListPartial(UserSearchQueryModel queryModel)
		{
			var userRoles = usersRepo.FilterUsers(queryModel);
			var model = GetUserListModel(userRoles);

			return PartialView("_UserListPartial", model);
		}
Beispiel #2
0
		public List<UserRolesInfo> FilterUsers(UserSearchQueryModel query)
		{
			return db.Users
				.FilterByName(query.NamePrefix)
				.FilterByRole(query.Role)
				.FilterByUserIds(
					userRolesRepo.GetListOfUsersWithCourseRole(query.CourseRole, query.CourseId),
					userRolesRepo.GetListOfUsersByPrivilege(query.OnlyPrivileged, query.CourseId)
				)
				.GetUserRolesInfo(50);
		}
Beispiel #3
0
        public List<UserRolesInfo> FilterUsers(UserSearchQueryModel query, UserManager<ApplicationUser> userManager)
        {
            var role = db.Roles.FirstOrDefault(r => r.Name == query.Role);
	        IQueryable<ApplicationUser> users = db.Users;
	        if (!string.IsNullOrEmpty(query.NamePrefix))
	        {
		        var usersIds = GetUsersByNamePrefix(query.NamePrefix).Select(u => u.Id);
		        users = users.Where(u => usersIds.Contains(u.Id));
	        }
	        return users
                .FilterByRole(role, userManager)
                .FilterByUserIds(
                    userRolesRepo.GetListOfUsersWithCourseRole(query.CourseRole, query.CourseId),
                    userRolesRepo.GetListOfUsersByPrivilege(query.OnlyPrivileged, query.CourseId)
                )
                .GetUserRolesInfo(50, userManager);
        }
Beispiel #4
0
		public ActionResult List(UserSearchQueryModel queryModel)
		{
			return View(queryModel);
		}
Beispiel #5
0
		public ActionResult Users(UserSearchQueryModel queryModel)
		{
			if (string.IsNullOrEmpty(queryModel.CourseId))
				return RedirectToAction("CourseList");
			return View(queryModel);
		}