示例#1
0
        public ActionResult EditMembers(int id)
        {
            var usersInProject = bugTrackerHelper.GetProjectUsersById(id);
            var allUsers       = bugTrackerHelper.GetAllUsers();
            var model          = new EditMembersViewModel();

            model.ProjectId      = id;
            model.ProjectName    = bugTrackerHelper.GetProjectNameById(id);
            model.ProjectMembers = usersInProject.Select(p => new User
            {
                UserId          = p.Id,
                UserDisplayName = p.DisplayName,
                UserRoles       = bugTrackerHelper.GetStringFromList(userManager.GetRoles(p.Id).ToList())
            }).ToList();

            model.NotMembers = allUsers.Where(u1 => !usersInProject.Any(u2 => u2.Id == u1.Id)).Select(p => new User
            {
                UserId          = p.Id,
                UserDisplayName = p.DisplayName,
                UserRoles       = bugTrackerHelper.GetStringFromList(userManager.GetRoles(p.Id).ToList())
            }).ToList();

            return(View(model));
        }