Exemplo n.º 1
0
 private List<JamPlayer> AddJamPlayers(Dictionary<string, Player> playerMap, Jam jam, IList<PlayerLineupModel> lineups, JamPlayerGateway gateway)
 {
     List<JamPlayer> list = new List<JamPlayer>();
     List<string> duplicateCheckList = new List<string>();
     foreach (PlayerLineupModel lineup in lineups)
     {
         if(lineup == null)
         {
             Console.WriteLine(jam.ToString() + ": empty player spot");
             continue;
         }
         if(duplicateCheckList.Contains(lineup.PlayerNumber))
         {
             throw new InvalidOperationException(string.Format("{0}: #{1} in lineup multiple times.", jam, lineup.PlayerNumber));
         }
         duplicateCheckList.Add(lineup.PlayerNumber);
         Player player = playerMap[lineup.PlayerNumber];
         list.Add(gateway.AddJamPlayer(jam.ID, player.ID, player.TeamID, lineup.IsJammer, lineup.IsPivot));
     }
     return list;
 }
Exemplo n.º 2
0
 private List<JamPlayer> AddJamPlayers(Dictionary<string, Player> playerMap, Jam jam, IList<PlayerLineupModel> lineups, JamPlayerGateway gateway)
 {
     List<JamPlayer> list = new List<JamPlayer>();
     foreach (PlayerLineupModel lineup in lineups)
     {
         if(lineup == null)
         {
             // TODO: handle null players
             Console.WriteLine(jam.ToString() + ": empty player spot");
             continue;
         }
         Player player = playerMap[lineup.PlayerNumber];
         list.Add(gateway.AddJamPlayer(jam.ID, player.ID, player.TeamID, lineup.IsJammer, lineup.IsPivot));
     }
     return list;
 }