private static void AddTeam(string team, string nickname, DateTime dateOfFoundation) { var newTeam = new Teams(team, nickname, dateOfFoundation); League.AddTeams(newTeam); Console.WriteLine($"Team {newTeam.Name} added to League"); }
public static void AddTeams(Teams team) { if (CheckIfTeamExists(team)) { throw new ArgumentException("League already have a team with this name"); } teams.Add(team); }
public Players(string firstName, string lastName, DateTime dateofbirth, decimal salary, Teams team) { this.FirstName = firstName; this.LastName = lastName; this.DateOfBirth = dateofbirth; this.Salary = salary; this.Team = team; }
public Matches(int id,Teams homeTeam, Teams awayTeam, Scores scores ) { if (homeTeam.Name == awayTeam.Name) { throw new ArgumentException("Home and away team must be different"); } this.HomeTeam = homeTeam; this.AwayTeam = awayTeam; this.Scores = scores; this.ID = id; }
private static bool CheckIfTeamExists(Teams team) { return teams.Any(p => p.Name == team.Name); }