Exemplo n.º 1
0
 public static ObservableCollection <Player> GetPlayers()
 {
     return(new ObservableCollection <Player>(Club.GetClubs().SelectMany(c => c.Players)));
 }
Exemplo n.º 2
0
		public static ObservableCollection<Club> GetClubs()
		{
			ObservableCollection<Club> clubs = new ObservableCollection<Club>();
			Club club;

			// Liverpool
			club = new Club("Liverpool", new DateTime(1892, 1, 1), 45362);
			club.Players.Add(new Player("Pepe Reina", 25, "Spain"));
			club.Players.Add(new Player("Jamie Carragher", 23,  "England"));
			club.Players.Add(new Player("Steven Gerrard", 8, "England"));
			club.Players.Add(new Player("Fernando Torres", 9,  "Spain"));
			clubs.Add(club);

			// Manchester Utd.
			club = new Club("Manchester Utd.", new DateTime(1878, 1, 1), 76212);
			club.Players.Add(new Player("Edwin van der Sar", 1, "Netherlands"));
			club.Players.Add(new Player("Rio Ferdinand", 5,  "England"));
			club.Players.Add(new Player("Ryan Giggs", 11,  "Wales"));
			club.Players.Add(new Player("Wayne Rooney", 10, "England"));
			clubs.Add(club);

			// Chelsea
			club = new Club("Chelsea", new DateTime(1905, 1, 1), 42055);
			club.Players.Add(new Player("Petr Čech", 1,  "Czech Republic"));
			club.Players.Add(new Player("John Terry", 26, "England"));
			club.Players.Add(new Player("Frank Lampard", 8,  "England"));
			club.Players.Add(new Player("Nicolas Anelka", 39,  "France"));
			clubs.Add(club);

			// Arsenal
			club = new Club("Arsenal", new DateTime(1886, 1, 1), 60355);
			club.Players.Add(new Player("Manuel Almunia", 1,  "Spain"));
			club.Players.Add(new Player("Gaël Clichy", 22,  "France"));
			club.Players.Add(new Player("Cesc Fàbregas", 4, "Spain"));
			club.Players.Add(new Player("Robin van Persie", 11,  "Netherlands"));
			clubs.Add(club);

			return clubs;
		}