コード例 #1
0
        public static void AssignShortestTeamToBibs(ObservableCollection<PlayerMatch> playerMatchList, IFootballRepository footballRepository)
        {
            var teams = footballRepository.GetTeams();
            var players = footballRepository.GetActivePlayers();

            playerMatchList.AssignTeamsBasedOnListOrder(teams);

            var playersInList = from player in players
                                  join playermatch in playerMatchList on player.PlayerID equals playermatch.PlayerID
                                  where player.Height != null
                                  select player;

            var shortestPlayer = GetShortestPlayer(playersInList);

            if (ShortestPlayerNotInFirstTeam(playerMatchList, shortestPlayer))
                playerMatchList.SwapTeams(teams);
        }