private void ButtonMakeBooking_OnClick(object sender, RoutedEventArgs e) { try { var date = GetSelectedDateTime(); var vet = (Veterinary)ComboBoxVeterinarians.SelectedItem; var animal = (AnimalSimple)ListBoxNameResult.SelectedItem; ValidateRequriedBookingFields(date, vet, animal); var booking = new AnimalBooking() { AnimalId = animal.AnimalId, AnimalName = animal.Name, DateTime = date, VeterinaryId = vet.Id, VeterinaryName = vet.Name }; DataAccessZoo dataAccess = new DataAccessZoo(); dataAccess.AddBooking(booking); MessageBox.Show("Bokningen är inlagd!"); UpdateCurrentBookingsListBox(); } catch (AddingDuplicateException exception) { MessageBox.Show(exception.Message); } catch (InvalidBookingDateTimeException exception) { MessageBox.Show(exception.Message); } catch (RequiredFieldsNullException exception) { MessageBox.Show(exception.Message); } }