private async void removeButton_Click(object sender, RoutedEventArgs e) { if (dataGrid.SelectedItems.Count > 0) { MessageBoxResult result = MessageBox.Show("Remove selected items?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { try { var client = await BacklogAPIClientBuilder.GetBackLogAPIClientAsync(); foreach (var selectedItem in dataGrid.SelectedItems) { var selectedAccessRightView = selectedItem as AccessRightView; if (selectedAccessRightView != null) { var accessRight = selectedAccessRightView.accessRight; var removedAccessRight = new RemovedAccessRight { RemovedAccessRightId = Guid.NewGuid(), DateRemoved = DateTime.Now, RemovedByUser = AppGlobals.UserThatIsLoggedin, AccessRight = accessRight }; await client.RemoveAccessRightAsync(removedAccessRight); } } RefreshUsersList(); MessageBox.Show("Done."); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } else { MessageBox.Show("You have not selected any items."); } }
public RemovedAccessRight RemoveAccessRight(RemovedAccessRight removedAccessRight) { return(new AccessRightsRepository().RemoveAccessRight(removedAccessRight)); }