Beispiel #1
0
        public void DeleteClient()
        {
            if (MessageBox.Show(String.Format(App.GetString("AreYouSureRemoveClientAndHistory"), SelectedClient.FullName), App.GetString("Removing"),
                                MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) != MessageBoxResult.Yes)
            {
                return;
            }

            var toRemove = SelectedClient;

            Task.Run(() =>
            {
                if (toRemove == null || SelectedClient != toRemove)
                {
                    return;
                }

                using (var dbService = _dbServiceManager.GetService())
                {
                    dbService.Clients.Delete(toRemove.Id);
                    AllClients.Remove(toRemove);
                    Clients.Remove(toRemove);
                }
            });
        }