private void CheckAirplane() { foreach (var x in Airplanes.Include(x => x.Company)) { Console.WriteLine($@"id:{x.AirplaneId}, name:{x.Manufacturer} {x.Model}, country:{x.Company.Name}"); } }
private void ShowStats() { Console.WriteLine("===============Air companies============"); foreach (var x in Companies.Include(a => a.Airplanes)) { Console.WriteLine( $"\n\nname:{x.Name}, country:{x.Country}\nAirplanes\n{string.Join('\n', x.Airplanes)} "); if (x.Airplanes == null) { x.Airplanes = new List <Airplane>(); } } Console.WriteLine("===============Airplanes============"); foreach (var x in Airplanes.Include(a => a.Trips)) { if (x.Trips == null) { x.Trips = new List <Trip>(); } String trips = x.Trips.Count == 0 ? "No flights planned" : $"{string.Join('\n', x.Trips)}"; Console.WriteLine( $"id:{x.AirplaneId}, company:{x.Company}, {x.Manufacturer}-{x.Model}\nTrips\n{trips}"); } }