Пример #1
0
        public static void AddCountries()
        {
            CountryRepositories cr = new CountryRepositories();

            cr.SaveCountry(new Country()
            {
                id_continent = 2, name = "USA"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 2, name = "Canada"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 2, name = "Mexica"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 3, name = "Argentina"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 3, name = "Brazilia"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 4, name = "Egypt"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 6, name = "Australia"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 7, name = "Germany"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 7, name = "Italia"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 7, name = "Sweden"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 7, name = "Finland"
            });
            cr.SaveCountry(new Country()
            {
                id_continent = 7, name = "Francia"
            });
        }
Пример #2
0
        static void Main(string[] args)
        {
            ContinentRepository continentRepo = new ContinentRepository();
            CountryRepositories countryRepo   = new CountryRepositories();
            CityRepositories    cityRepo      = new CityRepositories();

            //AddContinents();
            //AddCountries();
            //AddCities();
            Console.WriteLine("***Continents:");
            continentRepo.Print();

            Console.WriteLine("***Countries:");
            countryRepo.Print();

            Console.WriteLine("***Cities:");
            cityRepo.Print();

            City city = cityRepo.Cities.FirstOrDefault(c => c.name == "Berlin");

            Console.WriteLine("Find city: {0}", city);

            Console.ReadLine();
        }