protected override async void DeleteSelected() { if ( MessageBox.Show("Are you sure you want to delete this store?", "Agrimanagr: Delete Store", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) return; using (var c = NestedContainer) { if (Using<IMasterDataUsage>(c).CheckStoreIsUsed(SelectedStore.Store, EntityStatus.Deleted)) { MessageBox.Show( "Store " + SelectedStore.Store.Name + " has been used in a transaction. Deactivate or delete dependencies to continue.", "Agrimanagr: Delete Store", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } ResponseBool response = new ResponseBool() {Success = false}; if (SelectedStore == null) return; _proxy = Using<IDistributorServiceProxy>(c); response = await _proxy.StoreDeleteAsync(SelectedStore.Store.Id); if (response.Success) Using<IStoreRepository>(c).SetAsDeleted(SelectedStore.Store); MessageBox.Show(response.ErrorInfo, "Agrimangr: Manage Store", MessageBoxButton.OK, MessageBoxImage.Information); } }