public IActionResult OnPost()
        {
            if (!"requestTeam".Equals(action))
            {
                return(OnGet());
            }
            PoolContext dbCtx = new PoolContext();

            availableTeams   = dbCtx.Teams.OrderBy(t => t.Name).Where(t => !dbCtx.Owners.Select(o => o.TeamId).Contains(t.TeamId)).ToList();
            ownerAssignments = dbCtx.Owners.OrderBy(o => o.Username).ToList();
            checkCurrentOwnership(dbCtx);
            String userId   = HttpContext.User.FindFirst(ClaimTypes.Name).Value.ToString();
            String fullName = findFullName();

            if (canRequest)
            {
                Team  chosenTeam = availableTeams.ToArray()[new Random().Next(availableTeams.Count)];
                Owner newOwner   = new Owner {
                    Username = userId,
                    Team     = chosenTeam,
                    FullName = fullName
                };
                dbCtx.Owners.Add(newOwner);
                dbCtx.SaveChanges();
            }
            dbCtx.Dispose();
            return(OnGet());
        }
        public IActionResult OnGet()
        {
            PoolContext dbCtx = new PoolContext();

            availableTeams   = dbCtx.Teams.OrderBy(t => t.Name).Where(t => !dbCtx.Owners.Select(o => o.TeamId).Contains(t.TeamId)).ToList();
            ownerAssignments = dbCtx.Owners.Include(o => o.Team).OrderBy(o => o.Username).ToList();
            checkCurrentOwnership(dbCtx);
            dbCtx.Dispose();
            return(Page());
        }