private void PrintTeamRating(string[] args) { var teamName = args[1]; FootballTeam currentTeam = this.teamsList.FirstOrDefault(x => x.Name == teamName); if (currentTeam == null) { throw new NullReferenceException( string.Format(DataValidationExceptions.UnavailableTeamException(), teamName)); } Console.WriteLine(currentTeam); }
private void AddPlayerToTeam(string[] args, Player player) { var teamName = args[1]; var currentTeam = this.teamsList.FirstOrDefault(x => x.Name == teamName); if (currentTeam == null) { throw new NullReferenceException (string.Format(DataValidationExceptions.UnavailableTeamException(), teamName)); } currentTeam.AddPlayer(player); }
private void RemovePlayer(string[] args) { var teamName = args[1]; var playerName = args[2]; var currentTeam = this.teamsList.FirstOrDefault(x => x.Name == teamName); if (currentTeam == null) { throw new NullReferenceException (string.Format(DataValidationExceptions.UnavailableTeamException(), teamName)); } var currentPlayer = new Player(playerName); currentTeam.RemovePlayer(currentPlayer); }