Beispiel #1
0
        private void Itinialize()
        {
            this.Database.EnsureCreated();
            if (Flight.Any())
            {
                return;
            }

            Airplane.Add(new Airplane {
                Name = "Boing_747"
            });
            City.Add(new City {
                Name = "Moscow"
            });
            City.Add(new City {
                Name = "London"
            });
            Flight.Add(new Flight
            {
                AirplaneID   = 1,
                StartCityID  = 1,
                FinishCityID = 2,
                Time         = new System.DateTime(2021, 3, 13, 23, 0, 0)
            });
            SaveChanges();
        }
 private void AddFlightInfo(string flight, DateTime date, int Count)
 {
     Flight.Add(flight, date);
     FlightBaggageCount.Add(flight, Count);
     listBox.Items.Clear();
     foreach (var item in Flight)
     {
         listBox.Items.Add(item.Key);
     }
     listBox.SelectedIndex = listBox.Items.Count - 1;
 }
        private void Itinialize()
        {
            this.Database.EnsureCreated();
            if (Flight.Any())
            {
                return;
            }

            Airplane.Add(new Airplane {
                Name = "Boing_747"
            });
            Airplane.Add(new Airplane {
                Name = "Boing_746"
            });
            Airplane.Add(new Airplane {
                Name = "Boing_770"
            });
            Airplane.Add(new Airplane {
                Name = "Boing_761"
            });
            Airplane.Add(new Airplane {
                Name = "Boing_745"
            });
            City.Add(new City {
                Name = "Moscow"
            });
            City.Add(new City {
                Name = "Venus"
            });
            City.Add(new City {
                Name = "Paris"
            });
            City.Add(new City {
                Name = "London"
            });
            SaveChanges();
            Flight.Add(new Flight
            {
                AirplaneID   = Airplane.ToList()[0].ID,
                StartCityID  = City.ToList()[0].ID,
                FinishCityID = City.ToList()[1].ID,
                Time         = new System.DateTime(2021, 3, 20, 19, 30, 0)
            });
            Flight.Add(new Flight
            {
                AirplaneID   = Airplane.ToList()[1].ID,
                StartCityID  = City.ToList()[1].ID,
                FinishCityID = City.ToList()[2].ID,
                Time         = new System.DateTime(2021, 3, 21, 10, 0, 0)
            });
            SaveChanges();
        }
Beispiel #4
0
        private static void AddFlight()
        {
            Flight flight = new Flight();

            Console.Write("Enter flight name to be added: ");
            string userinput = Console.ReadLine();

            if (userinput != "null")
            {
                flight.Add(userinput);
                foreach (object obj in flight)
                {
                    Console.Write(obj.ToString() + " ");
                }
            }
            else
            {
                Console.Write("not allowed");
            }
        }