Exemplo n.º 1
0
        public IActionResult OnGet(string userId)
        {
            AddedUser = userData.GetUserById(userId);
            if (AddedUser == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            if (User.IsInRole("Admin"))
            {
                Teams = teamData.GetTeamsWhereUserNotMember(AddedUser.Id);
            }
            else if (User.IsInRole("Team Leader"))
            {
                IEnumerable <OmadaTeam> userNotMemberInTeams = teamData.GetTeamsWhereUserNotMember(AddedUser.Id);
                IEnumerable <OmadaTeam> LeaderTeams          = teamData.GetLeaderTeams(userManager.GetUserId(HttpContext.User));
                Teams = LeaderTeams.Where(u => userNotMemberInTeams.Any(l => l.Id == u.Id));
            }

            return(Page());
        }
Exemplo n.º 2
0
 public void OnGet()
 {
     Users = userManager.Users;
     Teams = teamData.GetLeaderTeams(userManager.GetUserId(HttpContext.User));
 }
Exemplo n.º 3
0
 public bool CheckIfUserIsLeader(int teamId)
 {
     return(teamData.GetLeaderTeams(userManager.GetUserId(HttpContext.User)).Where(t => t.Id == teamId).Any());
 }