public async void DeleteWallet() { try { IsEnabled = false; foreach (Transaction transaction in _tranService.GetTransactions()) { if (transaction.WalletGuid == _currentWallet.FromWallet.Guid) { if (_service.GetWallet(_currentWallet.FromWallet).Transactions.ToList().Exists(x => x.Guid == transaction.Guid)) { _tranService.DeleteTransaction(transaction); } } } await Task.Run(() => _service.DeleteWallet(CurrentWallet.FromWallet)); Wallets.Remove(CurrentWallet); } catch (Exception ex) { MessageBox.Show("Please,select the wallet by clicking on it in the list"); return; } finally { IsEnabled = true; } }
public async Task <IActionResult> DeleteWallet([FromRoute] string walletId) { try { await _walletService.DeleteWallet(userId, walletId); return(Ok()); } catch (Exception e) { return(BadRequest()); } }