Пример #1
0
        private void ButtonEditAmbulance_Click(object sender, RoutedEventArgs e)
        {
            var item = (Ambulance)dataGridAmbulances.SelectedItem;

            if (item == null)
            {
                return;
            }

            var ambulanceWindow = new AmbulanceForm(new AmbulanceDTO()
            {
                Address     = item.Address,
                OpeningHour = item.OpeningHour,
                ClosingHour = item.ClosingHour,
            });

            ambulanceWindow.Owner = this;
            ambulanceWindow.ShowDialog();

            if (ambulanceWindow.DialogResult == true)
            {
                ambulance.Edit(ambulanceWindow.Ambulance, item.Id);
                GetAmbulances();
            }
        }
Пример #2
0
        private void ButtonCreateAmbulance_Click(object sender, RoutedEventArgs e)
        {
            var ambulanceWindow = new AmbulanceForm(new AmbulanceDTO());

            ambulanceWindow.Owner = this;
            ambulanceWindow.ShowDialog();

            if (ambulanceWindow.DialogResult == true)
            {
                ambulance.Insert(ambulanceWindow.Ambulance);
                GetAmbulances();
            }
        }