Exemplo n.º 1
0
Arquivo: Team.cs Projeto: Penkov/OOP
 public void AddPlayer(Player player)
 {
     if (CheckIfPlayerExists(player))
     {
         throw new InvalidOperationException("Player already exists for that team.");
     }
     this.players.Add(player);
 }
Exemplo n.º 2
0
 private static void AddPlayerToTeam(string firstName, string lastName, DateTime bornDate, decimal salary, string teamName)
 {
     var team = teams.FirstOrDefault(t => t.Name == teamName);
     var player = new Player(firstName, lastName, bornDate, salary, teamName);
 }
Exemplo n.º 3
0
Arquivo: Team.cs Projeto: Penkov/OOP
 private bool CheckIfPlayerExists(Player player)
 {
     return this.players.Any(p => p.FirstName == player.FirstName &&
                                 p.LastName == player.LastName);
 }