public ActionResult <Transfer> CreateTransfer(Transfer newTransfer)
        {
            Transfer transfer           = TransferDAO.CreateTransfer(newTransfer);
            decimal  fromAccountBalance = AccountDAO.GetBalance(newTransfer.AccountFrom);
            decimal  toAccountBalance   = AccountDAO.GetBalance(newTransfer.AccountTo);
            bool     transferSuccessful = AccountDAO.SendMoney(transfer, fromAccountBalance, toAccountBalance);

            return(Created($"/transfers/{transfer.TransferId}", transfer));
        }
        public ActionResult <Transfer> CreateTransfer(Transfer newTransfer)
        {
            // get userId from the token
            int currentUserId = int.Parse(User.FindFirst("sub").Value);

            if (newTransfer.AccountFrom == currentUserId || (newTransfer.AccountTo == currentUserId && newTransfer.TransferTypeId == 1))
            {
                Transfer transfer = TransferDAO.CreateTransfer(newTransfer);

                // if the transfer was a send and was auto accepted
                if (transfer.TransferTypeId == 2)
                {
                    //update balances
                    bool transferSuccessful = AccountDAO.SendMoney(transfer);
                }
                return(Created($"/transfers/{transfer.TransferId}", transfer));
            }
            else
            {
                return(Forbid());
            }
        }