public void AddPlayer(Players player) { if (CheckIfPlayerExists(player)) { throw new InvalidOperationException("The player already exists."); } else { this.players.Add(player); } }
public bool CheckIfPlayerExists(Players player) { return this.players.Any(p => p.FirstName == player.FirstName && p.LastName == p.LastName); }