private void EditSection(object sender, MouseButtonEventArgs e) { int id = Convert.ToInt32(((Image)sender).Tag); EditSectionDialog dialog = new EditSectionDialog(id); dialog.ShowDialog(); }
private async void EditSection_Click(object sender, RoutedEventArgs e) { var selectedSection = (sender as MenuFlyoutItem).DataContext as Section; EditSectionName.Text = selectedSection.Name; if (await EditSectionDialog.ShowAsync() != ContentDialogResult.Primary) { return; } var editedSection = new SectionDTO { Name = EditSectionName.Text, SectionType = selectedSection.SectionType }; var updated = await _service.UpdateTripSection(_trip.Id, selectedSection.Id, editedSection); var index = _sections.IndexOf(selectedSection); if (index != -1) { _sections[index] = updated; } }