Ejemplo n.º 1
0
        public void RemoveTeam(FootballTeam team, Admin admin)
        {
            bool removed = false;

            if (teams.Count == 0)
            {
                throw new Exception("League cannot contain negative number of teams");
            }
            else
            {
                foreach (var existingTeam in teams)
                {
                    if (team.Equals(existingTeam))
                    {
                        teams.Remove(existingTeam);
                        removed = true;
                    }
                }
            }

            if (removed)
            {
                Console.WriteLine($"Succesfully removed {team.Name} from list");
            }
            else
            {
                Console.WriteLine($"Team doesn't exist in the list, thus couldn't be removed");
            }
        }