public ActionResult <bool> SendMoney(ClientTransfer clientTransfer) { int userId = int.Parse(User.FindFirst("sub")?.Value); Account userAccount = accountDAO.GetAccount(userId); Account destAccount = accountDAO.GetAccount(clientTransfer.OtherUserId); if (clientTransfer.IsRequest) { return(Ok(transferDAO.CreateTransfer(userAccount.AccountId, destAccount.AccountId, clientTransfer))); } else { if (userAccount.Balance >= clientTransfer.Amount) { accountDAO.DecreaseBalance(userAccount.AccountId, clientTransfer.Amount); accountDAO.IncreaseBalance(destAccount.AccountId, clientTransfer.Amount); return(Ok(transferDAO.CreateTransfer(userAccount.AccountId, destAccount.AccountId, clientTransfer))); } else { return(BadRequest("Insufficient funds to complete the transaction")); } } }