protected void SetSelectedTeam()
        {
            TeamOptions = GetTeamOptions();

            SelectedTeam = null;
            if (_seasonStatsParameters.teamId != null)
            {
                SelectedTeam = TeamOptions
                               .Where(t => t.Id == _seasonStatsParameters.teamId)
                               .FirstOrDefault();

                // Check if team was under a different name
                if (SelectedTeam == null)
                {
                    var franchise = _database.Franchises
                                    .Where(f => f.Teams
                                           .Select(t => t.Id)
                                           .ToList()
                                           .Contains(_seasonStatsParameters.teamId.Value))
                                    .FirstOrDefault();

                    if (franchise != null)
                    {
                        SelectedTeam = franchise.Teams
                                       .Where(t => t.Id == _seasonStatsParameters.teamId)
                                       .FirstOrDefault();
                    }
                }
            }
        }
Exemple #2
0
        public async Task OnGetAsync()
        {
            //Getting players from database
            var players = from p in _context.Players
                          select p;

            //populating the Team Select options in the view page
            TeamOptions = await _context.Players.Select(t => new SelectListItem
            {
                Value = t.TeamId,
                Text  = t.TeamId
            }).Distinct().ToListAsync();

            //This inserts for the default all
            TeamOptions.Insert(0, new SelectListItem
            {
                Value = "All",
                Text  = "All"
            });

            //populating the Position options in the View page
            PositionOptions = await _context.Players.Select(p => new SelectListItem
            {
                Value = p.Position,
                Text  = p.Position
            }).Distinct().ToListAsync();

            PositionOptions.Insert(0, new SelectListItem
            {
                Value = "All",
                Text  = "All"
            });

            //Checks to see if the user inputed a name to search for, if so look and change the players list
            if (!String.IsNullOrEmpty(SearchString))
            {
                players = from p in players
                          where p.Name.ToLower().Contains(SearchString.ToLower())
                          select p;
            }

            //Checks to see if user changed selected team option from all, if so then change the resulting players shown
            if (SelectedTeam != "All")
            {
                players = from p in players
                          where (p.TeamId == SelectedTeam)
                          select p;
            }

            //Checks to see if user changed selected position option from all, if so then change the resulting players shown
            if (SelectedPosition != "All")
            {
                players = from p in players
                          where (p.Position == SelectedPosition)
                          select p;
            }

            //This is the end result of the players that get sent to the view page.
            Players = players.ToList();
        }
 private void SetSelectedTeam(int?teamId)
 {
     SelectedTeam = null;
     if (teamId != null)
     {
         SelectedTeam = TeamOptions
                        .Where(t => t.Id == teamId)
                        .FirstOrDefault();
     }
 }
Exemple #4
0
 public async Task <PnPContext> CreateTeamAsync(TeamOptions teamToCreate, TeamCreationOptions creationOptions = null)
 {
     if (teamToCreate is TeamForGroupOptions teamForGroupOptions)
     {
         return(await TeamCreator.CreateTeamForGroupAsync(context, teamForGroupOptions, creationOptions).ConfigureAwait(false));
     }
     else
     {
         throw new Exception("Coming soon");
     }
 }
 protected void SerializeTeams <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
     where TDoc : class
     where TCursor : class
 {
     using (var bm = s.EnterCursorBookmarkOpt("Teams", TeamOptions, opts => !opts.IsDefault)) if (bm.IsNotNull)
         {
             s.StreamObject(TeamOptions);
         }
         else if (s.IsReading)
         {
             TeamOptions.RevertToDefault();
         }
 }
        private void SetSelectedTeam(int?teamId)
        {
            SelectedTeam = null;
            if (teamId != null)
            {
                SelectedTeam = TeamOptions
                               .Where(to => to.Id == teamId)
                               .FirstOrDefault();

                if (SelectedTeam == null)
                {
                    AlertMessage = "That team could not be found.";
                }
            }
        }
Exemple #7
0
        public TeamDTO Team_GetByID(int id, TeamOptions options)
        {
            TeamService service = new TeamService();

            return(service.GetByID(id, options));
        }
 public TeamDTO GetByID(int id, TeamOptions options)
 {
     return(Mapper.Map <TeamDTO>(_context.Teams.Where(x => x.Id == id).AddIncludeStatements(options).First()));
 }
Exemple #9
0
 private static string BuildTeamCreationBody(TeamOptions options)
 {
     return("{}");
 }
Exemple #10
0
 public PnPContext CreateTeam(TeamOptions teamToCreate, TeamCreationOptions creationOptions = null)
 {
     return(CreateTeamAsync(teamToCreate, creationOptions).GetAwaiter().GetResult());
 }