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]); } }
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(); }
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)); }
// 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)); }
public List <Country> GetCountries() { //owner? var user = User.Identity.Name; List <Country> countries = countryDAO.GetCountries(); return(countries); }
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(); }
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); }
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)); }
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)); }
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)); }
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); }
public List <Country> GetCountries() { List <Country> countries = countryDao.GetCountries(); return(countries); }
public IActionResult Index() { var countries = _countryDao.GetCountries(); return(View(countries)); }