private void FillDbIfEmpty(AppContext context) { if (context.Cities.Any()) { return; } var builder = new AppDbBuilder(); builder.MakeCitiesDbFromJson(); }
public Controller(string[] args, ICitiesRepository citiesRepository, ICashedForecastsRepository cashRepository) { _cmdline = new Arguments(args); _view = new View(); using (AppContext context = new AppContext()) { context.Database.EnsureCreated(); FillDbIfEmpty(context); } _citiesRepository = citiesRepository; _cashRepository = cashRepository; Process(); }