static void Main(string[] args) { // Select all countries //GetAllCountries(); // Get a count of all countries //GetCountryCount(); // Select cities that belong to a country code //GetCitiesForCountryCode("USA"); //Console.ReadKey(); //return; //IConfigurationBuilder builder = new ConfigurationBuilder() // .SetBasePath(Directory.GetCurrentDirectory()) // .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); //IConfigurationRoot configuration = builder.Build(); //string connectionString = configuration.GetConnectionString("World"); ICityDAO cityDAO = null; ICountryDAO countryDAO = new CountrySqlDAO(connectionString); ILanguageDAO languageDAO = null; WorldGeographyCLI cli = new WorldGeographyCLI(cityDAO, countryDAO, languageDAO); cli.RunCLI(); }
/// <summary> /// Constructor adds items to the top-level menu /// </summary> public CountryMenu(Country country, ICityDAO cityDAO, ICountryLanguageDAO countryLanguageDAO) { // Update this constructor to accept appropriate daos, and save them in local variables. this.cityDAO = cityDAO; this.countryLanguageDAO = countryLanguageDAO; // Save the country (which will be used for all country queries this.country = country; // This code is just protection because before we complete the code, Country may be null if (country == null) { country = new Country(); } // Add options to this menu AddOption($"List Cities in {country.Name}", ListCities) .AddOption($"List Languages in {country.Name}", ListLanguages) .AddOption($"Add a city to {country.Name}", AddCity) .AddOption("Remove a city", RemoveCity) .AddOption("Back", Exit); Configure(cfg => { cfg.ItemForegroundColor = ConsoleColor.DarkGreen; cfg.SelectedItemForegroundColor = ConsoleColor.Green; }); }
public UserInterface(string connectionString) { this.connectionString = connectionString; venueDAO = new VenueSqlDAO(connectionString); cityDAO = new CitySqlDAO(connectionString); spaceDAO = new SpaceSqlDAO(connectionString); reservationDAO = new ReservationSqlDAO(connectionString); }
static void Main(string[] args) { //IConfigurationBuilder builder = new ConfigurationBuilder() // .SetBasePath(Directory.GetCurrentDirectory()) // .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); //IConfigurationRoot configuration = builder.Build(); //string connectionString = configuration.GetConnectionString("World"); ICityDAO cityDAO = null; ICountryDAO countryDAO = null; ILanguageDAO languageDAO = null; WorldGeographyCLI cli = new WorldGeographyCLI(cityDAO, countryDAO, languageDAO); cli.RunCLI(); }
/// <summary> /// Constructor adds items to the top-level menu /// </summary> public WorldDBMenu(ICountryDAO countryDAO, ICityDAO cityDAO) { this.CountryDao = countryDAO; this.cityDAO = cityDAO; // TODO 05a: Change this constructor to require country dao // TODO 15a: Change this constructor to require country-language dao // TODO 05d: Assign the Interfaces to protected variables so we can use them later // Add options to this menu AddOption("List Countries", ListCountries) .AddOption("List Countries on a continent", ListCountriesForContinent) .AddOption("Select a country", SelectACountry) .AddOption("Quit", Exit); Configure(cfg => { cfg.ItemForegroundColor = ConsoleColor.Yellow; cfg.SelectedItemForegroundColor = ConsoleColor.Green; }); }
public CityController(ICityDAO dao) { this.dao = dao; }
public WorldGeographyCLI(ICityDAO cityDAO, ICountryDAO countryDAO, ILanguageDAO languageDAO) { this.cityDAO = cityDAO; this.languageDAO = languageDAO; this.countryDAO = countryDAO; }
public CityController(ICityDAO cityDao) { this.cityDao = cityDao; }
public CityController(ICityDAO cityDAO, ICountryDAO countryDAO) { this.cityDAO = cityDAO; this.countryDAO = countryDAO; }
/// <summary> /// Parameterized Constructor /// </summary> /// <param name="cityDAO"></param> public CityManager(ICityDAO cityDAO) { this.cityDAO = cityDAO; }
public CountryController(ICityDAO cityDao, ICountryDAO countryDao, ILanguageDAO languageDao) { this.cityDao = cityDao; this.countryDao = countryDao; this.languageDao = languageDao; }
// DI: Step 2 - Add any necessary interfaces as parameters only if needed in this controller public WorldController(ICountryDAO countryDao, ICityDAO cityDao) { _countryDao = countryDao; _cityDao = cityDao; }
// TODO 02 (Controller): Derive the city controller from AppController so we have access to authProvider // Note that we have to inject an IAuthProvider and pass it to the base contructor public CityController(ICityDAO cityDAO, ICountryDAO countryDAO, IAuthProvider authProvider) : base(authProvider) { this.cityDAO = cityDAO; this.countryDAO = countryDAO; }
public HomeController(ICityDAO dao) { _dao = dao; }
public WorldController(ICountryDAO countryDAL, ICityDAO cityDAL) { this.countryDAL = countryDAL; this.cityDAL = cityDAL; }
public Day1Controller(ICityDAO dao) { this.dao = dao; }
public WorldController(ICountryDAO countryDao, ICityDAO cityDao) { this.countryDao = countryDao; this.cityDao = cityDao; }
/// <summary> /// Default Constructor /// </summary> public CityManager() { cityDAO = CityDAOFactory.GetInstance().CreateCity(); }
public HomeController(ICityDAO c) { this.cityDAO = c; }
public CityController(IAuthProvider authProvider, ICityDAO cityDAO) : base(authProvider) { this.cityDAO = cityDAO; }
/// <summary> /// Constructor adds items to the top-level menu /// </summary> public WorldDBMenu(ICityDAO cityDAO, ICountryDAO countryDAO, ILanguageDAO languageDAO) : base() { this.cityDAO = cityDAO; this.languageDAO = languageDAO; this.countryDAO = countryDAO; }
public CityController(ICityDAO cityDAO) { this.cityDAO = cityDAO; }
public Day2Controller(ICityDAO db) { _db = db; }
/// <summary> /// Constructor adds items to the top-level menu /// </summary> public CountryMenu(Country country, ICityDAO cityDAO, ICountryDAO countryDAO, ILanguageDAO languageDAO) : base(cityDAO, countryDAO, languageDAO) { // Save the country (which will be used for all country queries this.country = country; }
public HomeController(ICityDAO cityDAL) { this.cityDAL = cityDAL; }
// TODO 04 (Controller): implement dependency injection to get CityDAO /// <summary> /// Create a new CitiesController /// </summary> /// <param name="logger">Dunno, was included with MVC API project</param> /// <param name="cityDAO">A Data Access Object to get cities fomr the DB (or whereever)</param> public CitiesController(ILogger <CitiesController> logger, ICityDAO cityDAO) { _logger = logger; this.cityDAO = cityDAO; }
public Day2Controller(ICityDAO icd) { cityDAO = icd; }