Ejemplo n.º 1
0
 private void SetUsers(int?teamId)
 {
     if (!teamId.HasValue)
     {
         TeamExists     = false;
         Team           = new OmadaTeam();
         NotTeamMembers = new List <NotTeamMember>();
         foreach (var user in userManager.Users.Where(u => u.Id != userManager.GetUserId(User)))
         {
             NotTeamMembers.Add(new NotTeamMember()
             {
                 User       = user,
                 IsSelected = false
             });
         }
     }
     else
     {
         TeamExists     = true;
         Team           = teamData.GetTeamById(teamId.Value);
         NotTeamMembers = teamData.UsersNotInTeam(Team.Id);
         TeamMembers    = new List <TeamMember>();
         foreach (var member in teamData.GetTeamUsers(Team.Id))
         {
             TeamMembers.Add(new TeamMember()
             {
                 User     = member,
                 IsLeader = teamData.GetTeamLeaders(Team).Where(l => l.Id == member.Id).Any() ? true : false,
                 Remove   = false
             });
         }
     }
 }
Ejemplo n.º 2
0
        public void OnGet()
        {
            IEnumerable <OmadaTeam> teams = new List <OmadaTeam>();

            if (User.IsInRole("Admin"))
            {
                teams = teamData.GetAllTeams();
            }
            else
            {
                teams = teamData.GetAllTeams().Where(t => t.IsPublic == true).ToList();
                IEnumerable <OmadaTeam> privateUserTeams = (teamData.GetUserTeams(userManager.GetUserId(User)).Where(t => t.IsPublic == false)).ToList();
                teams = teams.Concat(privateUserTeams);
            }
            foreach (var team in teams)
            {
                List <OmadaUser> teamUsers = new List <OmadaUser>();
                teamUsers = teamData.GetTeamUsers(team.Id);
                Teams_Users.Add(team, teamUsers);
            }
        }