public API_Transfer TransferTEBucks(API_Transfer transfer) { RestRequest request = new RestRequest(BASE_URL + "/transfer"); request.AddJsonBody(transfer); IRestResponse <API_Transfer> response = client.Post <API_Transfer>(request); if (response.IsSuccessful && response.ResponseStatus == ResponseStatus.Completed) { return(response.Data); } else { Console.WriteLine("An error occurred attempting to transfer funds"); return(null); } }
public bool RequestToTransferToAnotherAccount(string username, decimal amtToTransfer, API_Transfer transfer) { bool isSufficient; API_Account account = GetBalance(username); if (account == null) { isSufficient = false; } else if (account.AccountBalance < amtToTransfer) { Console.WriteLine($"You do not have sufficient funds for the transfer, your current balance is ${account.AccountBalance}."); isSufficient = false; } else { RestRequest request = new RestRequest(BASE_URL + "/maketransfer/" + username); request.AddJsonBody(transfer); IRestResponse <API_Transfer> response = client.Post <API_Transfer>(request); //Put in an if Console.WriteLine("The Transfer was successful."); isSufficient = true; } return(isSufficient); }