Пример #1
0
        private void FillDbIfEmpty(AppContext context)
        {
            if (context.Cities.Any())
            {
                return;
            }
            var builder = new AppDbBuilder();

            builder.MakeCitiesDbFromJson();
        }
Пример #2
0
        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();
        }