public void Addpassenger(string name, string secondname, string pasport, string dateofbirthday, Sex sex, Nationality nationality) { var passenger = new Passengers(); passenger.Name = name; passenger.Secondname = secondname; passenger.Pasport = pasport; passenger.Dateofbirthday = dateofbirthday; passenger.Sex = sex; passenger.Nationality = nationality; Passengersarr.Add(passenger); }
public void CreatePassenger() { Console.Clear(); Passengers cr = null; Random random = new Random(); Flight cr2 = null; cr2 = new Flight(); cr = new Passengers(); Console.Clear(); Console.Write("Input Name:"); cr.Name = Console.ReadLine(); Console.WriteLine(); Console.Write("Input Secondname:"); cr.Secondname = Console.ReadLine(); Console.WriteLine(); Console.Write("Input Pasport:"); cr.Pasport = Console.ReadLine(); Console.WriteLine(); Console.Write("Input Dateofbirthday D.M.Y: "); cr.Dateofbirthday = Console.ReadLine(); Console.WriteLine(); Console.Write("Sex\nMale - 1\nFemale - 2"); ConsoleKeyInfo key = Console.ReadKey(); Console.Clear(); switch (key.Key) { case ConsoleKey.D1: case ConsoleKey.NumPad1: cr.Sex = Sex.Male; break; case ConsoleKey.D2: case ConsoleKey.NumPad2: cr.Sex = Sex.Female; break; } flights.Add(cr2); cr2.Passengersarr.Add(cr); }