public RemovedCustomer RemoveCustomer(RemovedCustomer removedCustomer) { var result = new CustomersRepository().RemoveCustomer(removedCustomer); // Push notification pushNotificationsRepository.NotifyAsync(OperationContext.Current, subscriber => subscriber.CustomerWasRemovedNotification(result.RemovedCustomerId)); return(result); }
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 selectedCustomerView = selectedItem as CustomerView; if (selectedCustomerView != null) { var customer = selectedCustomerView.customer; var removedCustomer = new RemovedCustomer { RemovedCustomerId = Guid.NewGuid(), DateRemoved = DateTime.Now, RemovedByUser = AppGlobals.UserThatIsLoggedin, Customer = customer }; await client.RemoveCustomerAsync(removedCustomer); } } RefreshCustomersList(); MessageBox.Show("Done."); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } else { MessageBox.Show("You have not selected any items."); } }