private void editPlaceBtn_MouseDown(object sender, MouseButtonEventArgs e) { var idPlace = ((TextBlock)sender).Uid; var placeCurrent = TripDAO.GetPlaceById(idTrip, idPlace); var addPlaceDialog = new AddPlaceDialog(); addPlaceDialog.NewPlace = placeCurrent; if (addPlaceDialog.ShowDialog() == true) { var newPlace = addPlaceDialog.NewPlace; TripDAO.RemovePlace(idTrip, idPlace); TripDAO.InsertPlaces(idTrip, newPlace); DisplayDetail(); MessageBox.Show("Đã cập nhật thành công!"); } }
private void addPlaceButton_Click(object sender, RoutedEventArgs e) { var addPlaceDialog = new AddPlaceDialog(); if (addPlaceDialog.ShowDialog() == true) { var newplace = addPlaceDialog.NewPlace; if (trip.Places == null) { trip.Places = new List <Place>(); } trip.Places.Add(newplace); placesListView.ItemsSource = null; placesListView.ItemsSource = trip.Places; TripDAO.InsertPlaces(idTrip, newplace); } }