public async Task <IActionResult> WalletNotified(string txid) { try { var existentTransaction = transactionService.FindInDatabase(txid); var transaction = await transactionService.GetTransaction(txid); if (existentTransaction == null) { transactionService.Add(transaction); } else { transactionService.UpdateConfirmations(transaction.TxId, transaction.Confirmations); } if (walletService.GetWallet() == null) { await walletService.CreateWalletIfNecessary(); } else { await walletService.UpdateWalletBalance(); } await unitOfWork.SaveChanges(); existentTransaction = transactionService.FindInDatabase(txid); return(Ok(existentTransaction.TxId)); } catch (RpcErrorException ex) { return(BadRequest(ex.Error)); } }