Example #1
0
 public void AddPlayer(Player player)
 {
     if (CheckIfPlayerExists(player))
     {
         throw new InvalidOperationException("The Player already exists in the team.");
     }
     else
     {
         this.players.Add(player);
     }
 }
Example #2
0
 private bool CheckIfPlayerExists(Player player)
 {
     return this.players.Any(p => p.FirstName == player.FirstName && p.LastName == player.LastName);
 }