public void FileWriter(Passenger pass) { List<Passenger> readAgain = this.PassManifest; readAgain.Add(pass); string listOfPassengers = JsonConvert.SerializeObject(readAgain, Formatting.Indented); File.WriteAllText("../../manifest.json", listOfPassengers); }
private void button_Click(object sender, RoutedEventArgs e) { Manifest Main = new Manifest(); this.Main = new Manifest(); Marionette = new Plane(true, 3000); this.Marionette = new Plane(true, 3000); FileRead readWrite = new FileRead(); this.readWrite = new FileRead(); readWrite.FileReader(); int seatsToSubtract = readWrite.PassManifest.Count(); readWrite.seatsToSubtract(Marionette.Airplane320); NumOfSeats.Text = Marionette.Airplane320.Count.ToString(); PlaneName.Text = this.PlaneNames; FlightInformation.Text = this.FlightInfo; foreach (Seat chair in Marionette.Airplane320) { ListOfAvailableSeats.Items.Add(chair); } Marionette.PurchaseSeat(Marionette.Airplane320); string seatID = Marionette.assignToPerson(); Passenger person = new Passenger(PassengerName.Text, Age.Text, Email.Text, seatID); Main.AddPassengerToManifest(person); readWrite.FileWriter(person); PassengerName.Text = ""; Age.Text = ""; Email.Text = ""; }
public void AddPassengerToManifest(Passenger pass) { PassManifest.Add(pass); }