public void testEntityFramwork() { var flightWrapper = new FlightWrapper(AirportPages.BenGurion); var flights = new List <Flight>(); for (int i = 0; i < 30; i++) { var date = DateTime.Now.AddDays(i); var flight = flightWrapper.GetFlightsByDate(date); Console.WriteLine("{0}: {1} flights", date, flight.Count); flights = flights.Count == 0 ? flight : flights.Concat(flight).ToList(); } Console.WriteLine(flights.Count); //var date = DateTime.Now; //var flights = flightWrapper.GetFlightsByDate(date); var flightsHandler = new FlightsService(); flightsHandler.SaveFlights(flights); var f = flightsHandler.GetAll(); }
public void collectData() { try { var flightsWrapper = new FlightWrapper(AirportPages.BenGurion); var flightsHandler = new FlightsService(); var date = DateTime.Parse("24/03/2021 00:00:00"); while (date < DateTime.Parse("29/03/2021 00:00:00")) { var flights = flightsWrapper.GetFlightsByDate(date); Console.WriteLine($"{date}: {flights.Count} flights"); flightsHandler.SaveFlights(flights); date = date.AddDays(1); } } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }