Beispiel #1
0
        public EditTransportationPassenger(transportation_passangers o)
        {
            InitializeComponent();

            TransportationComboBox.ItemsSource       = db.transportation.ToList();
            TransportationComboBox.DisplayMemberPath = "Id";
            PassengerComboBox.ItemsSource            = db.passenger.ToList();
            PassengerComboBox.DisplayMemberPath      = "last_name";

            t = o;

            TransportationComboBox.SelectedValue = db.transportation.ToList().First(d => d.Id == t.transportation_id);
            PassengerComboBox.SelectedValue      = db.passenger.ToList().First(d => d.Id == t.passenger_id);
        }
        private void EditTransportatioPassengern_Click(object sender, RoutedEventArgs e)
        {
            transportation_passangers s = (transportation_passangers)TransportationPassengerDataGrid.SelectedItem;

            if (s == null)
            {
                return;
            }
            EditTransportationPassenger window = new EditTransportationPassenger(s);

            Hide();
            window.ShowDialog();
            Show();
            UpdateTransportationPassengersDataGrid();
        }
Beispiel #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            transportation transportation = (transportation)TransportationComboBox.SelectedItem;
            passenger      passenger      = (passenger)PassengerComboBox.SelectedItem;

            transportation_passangers o = new transportation_passangers();

            o.transportation_id = transportation.Id;
            o.passenger_id      = passenger.Id;

            db.transportation_passangers.Add(o);

            db.SaveChanges();

            this.Close();
        }