private void EditReservationButton_Click(object sender, System.EventArgs e) { var selectedReservation = (Reservation)this.reservationBindingSource.Current; if (selectedReservation == null) { MessageBox.Show("Не е избрана резервация за редакция!"); return; } var editForm = new ReservationAddEditForm(selectedReservation); editForm.ShowDialog(); if (editForm.DialogResult == DialogResult.OK) { var reservation = editForm.Reservation; if (reservation != null) { this.reservationRepository.AddOrUpdateReservation(reservation); this.RefreshReservations(); } } }
private void AddReservationButton_Click(object sender, System.EventArgs e) { var editForm = new ReservationAddEditForm(null); editForm.ShowDialog(); if (editForm.DialogResult == DialogResult.OK) { var reservation = editForm.Reservation; if (reservation != null) { this.reservationRepository.AddOrUpdateReservation(reservation); this.RefreshReservations(); } } }