Esempio n. 1
0
        private static void Setup()
        {
            var settlementRepo = new SettlementRepository();
            var fuelRepo       = new FuelChargeRepository();

            Task.WhenAll(
                settlementRepo.EnsureDatabaseAsync(),
                fuelRepo.EnsureDatabaseAsync()
                ).Wait();
            System.Console.WriteLine("Setup database.");
        }
Esempio n. 2
0
        private static void SaveFuelCharges(string file)
        {
            System.Console.WriteLine($"Saving {file} fuel charges to database.");
            FuelChargeRepository repository = new FuelChargeRepository();

            var loadTask = repository.LoadAsync(file);

            Task.Run(async() => {
                await repository.EnsureDatabaseAsync();
                await loadTask;
                repository.SaveAsync(repository.Charges);
                System.Console.WriteLine($"Saved {repository.Charges?.Count()} charge(s).");
            }).Wait();
        }