private void Update_Click(object sender, RoutedEventArgs e) { var update = MessageBox.Show("Would you like to update the data??", "Update Data", MessageBoxButton.YesNo, MessageBoxImage.Question); if (update == MessageBoxResult.Yes) { passenger pas = new passenger(a.Count, int.Parse(custId_tb.Text), int.Parse(flightId_tb.Text)); a[lpassenger.SelectedIndex] = pas; var pass = from upd in a select upd.CustomerId; lpassenger.DataContext = pass; custId_tb.Clear(); flightId_tb.Clear(); MessageBox.Show("Details have been successfully Updated!!!", "Data Updated", MessageBoxButton.OK, MessageBoxImage.Information); } }
public void Updatebtn_Click(object sender, RoutedEventArgs e) { if (custId_tb.Text == "" || flightId_tb.Text == "") { MessageBox.Show("All fields are required to update details", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { var update = MessageBox.Show("Would you like to update the data??", "Update Data", MessageBoxButton.YesNo, MessageBoxImage.Question); if (update == MessageBoxResult.Yes) { passenger pas1 = new passenger(a.Count, int.Parse(custId_tb.Text), int.Parse(flightId_tb.Text)); a[lpassenger.SelectedIndex] = pas1; var pass = from up in a select up.CustomerId; lpassenger.DataContext = pass; custId_tb.Clear(); flightId_tb.Clear(); MessageBox.Show("Details have been successfully Updated!!!", "Data Updated", MessageBoxButton.OK, MessageBoxImage.Information); } } }