コード例 #1
0
        private void GetCountries()
        {
            IList <Country> countries = countryDAO.GetCountries();

            Console.WriteLine();
            Console.WriteLine("Printing all of the countries");

            for (int index = 0; index < countries.Count; index++)
            {
                Console.WriteLine(index + " - " + countries[index]);
            }
        }
コード例 #2
0
        private void ListCountries(string continent)
        {
            IList <Country> countries = countryDAO.GetCountries(continent);

            SetColor(ConsoleColor.Green);
            Console.WriteLine(Country.GetHeader());
            foreach (Country country in countries)
            {
                Console.WriteLine(country);
            }
            ResetColor();
        }
コード例 #3
0
        public IActionResult Search(CitySearchVM vm)
        {
            if (vm.CountryCode == null && vm.District == null)
            {
                ViewData["Message"] = "Enter search criteria";
                vm.Cities           = new List <City>();
            }
            else
            {
                vm.Cities = cityDAO.GetCities(vm.CountryCode, vm.District);
            }

            // TODO 01c: Populate the country list on the view model by calling GetCountrySelectList

            // Call GetCountries() on the countryDAO

            // TODO 01: Add a SelectList to the view-model for country codes.
            // TODO 01b: Add a method to Generate Select List from the Country DAO. (GetCountrySelectList)
            //          This will require us to ask for another "injected" DAO
            IList <Country> countries = countryDAO.GetCountries();

            vm.CountryList = new SelectList(countries, "Code", "Name");

            return(View(vm));
        }
コード例 #4
0
        // 1. Create WorldController / Index action so that user can
        //      navigate to /world OR /world/index
        public IActionResult Index()
        {
            //5. Call the DAL
            //var countryDAL = new CountrySqlDAL(@"Data Source=.\sqlexpress;Initial Catalog=world;Integrated Security=true;");
            var countries = countryDAL.GetCountries();

            //6. Pass the model into the view
            return(View(countries));
        }
コード例 #5
0
        public List <Country> GetCountries()
        {
            //owner?
            var user = User.Identity.Name;

            List <Country> countries = countryDAO.GetCountries();

            return(countries);
        }
コード例 #6
0
        private void ListCountries()
        {
            // TODO 04: Get the list of countries for a continent (GetCountries)
            IList <Country> countries = countryDAO.GetCountries();

            SetColor(ConsoleColor.Blue);
            Console.WriteLine(Country.GetHeader());
            foreach (Country country in countries)
            {
                Console.WriteLine(country);
            }
            ResetColor();
        }
コード例 #7
0
        private MenuOptionResult ListCountriesForContinent()
        {
            string continent = GetString("Continent: ", true);

            // TODO 07: Get the list of countries for a continent (GetCountries)
            IList <Country> countries = countryDAO.GetCountries(continent);

            SetColor(ConsoleColor.Green);
            Console.WriteLine(Country.GetHeader());
            foreach (Country country in countries)
            {
                Console.WriteLine(country);
            }
            ResetColor();
            return(MenuOptionResult.WaitAfterMenuSelection);
        }
コード例 #8
0
ファイル: CityController.cs プロジェクト: sryan488/TE
        public IActionResult Search(CitySearchVM vm)
        {
            vm.Cities = cityDAO.GetCities(vm.CountryCode, vm.District);

            if (vm.CountryCode != null && vm.CountryCode.Length > 0)
            {
                ViewData["Message"] = $"{vm.Cities.Count} cities were found";
            }

            // Set the CountryList property on the VM for dropdown display
            IList <Country> countries = countryDAO.GetCountries();

            vm.CountryList = new SelectList(countries, "Code", "Name");

            return(View(vm));
        }
コード例 #9
0
ファイル: CityController.cs プロジェクト: sryan488/TE
        public IActionResult Search(CitySearchVM vm)
        {
            // TODO 01: See View City\Search.cshtml and update labels

            vm.Cities = cityDAO.GetCities(vm.CountryCode, vm.District);

            // TODO 05: Set the CountryList property on the VM for dropdown display
            IList <Country> countries = countryDAO.GetCountries();

            vm.CountryList = new SelectList(countries, "Code", "Name");


            //List<SelectListItem> selectListItems = new List<SelectListItem>();
            //selectListItems.Add(new SelectListItem("Saturn", "Saturn"));

            return(View(vm));
        }
コード例 #10
0
        public IActionResult Search(CitySearchVM vm)
        {
            // TODO 01: NOTE we are setting a Message if there is no search criteria
            if (vm.CountryCode == null && vm.District == null)
            {
                ViewData["Message"] = "Enter search criteria";
                vm.Cities           = new List <City>();
            }
            else
            {
                vm.Cities = cityDAO.GetCities(vm.CountryCode, vm.District);
            }

            // Populate the country list on the view model
            // Call GetCountries() on the countryDAO.
            IList <Country> countries = countryDAO.GetCountries();

            vm.CountryList = new SelectList(countries, "Code", "Name");

            return(View(vm));
        }
コード例 #11
0
        public IActionResult Search(CitySearchVM vm)
        {
            if (vm.CountryCode == null && vm.District == null)
            {
                ViewData["Message"] = "Enter search criteria";
                vm.Cities = new List<City>();
            }
            else
            {
                vm.Cities = cityDAO.GetCities(vm.CountryCode, vm.District);
            }

            // TODO 01c: Populate the country list on the view model by calling GetCountrySelectList
            // Call GetCountries() on the CountryDAO

            IList<Country> countries = countryDAO.GetCountries();

            vm.CountryList = new SelectList(countries, "Code", "Name");

            return View(vm);
        }
コード例 #12
0
        public List <Country> GetCountries()
        {
            List <Country> countries = countryDao.GetCountries();

            return(countries);
        }
コード例 #13
0
        public IActionResult Index()
        {
            var countries = _countryDao.GetCountries();

            return(View(countries));
        }