/// <summary> /// Attempts to process a monetary transaction as requested by the client /// </summary> /// <param name="type">The type of transaction (withdraw, deposit)</param> /// <param name="amount">The amount of money to adjust the account by</param> /// <returns>True if the transaction is successful. Otherwise false.</returns> public bool PostTransaction(TransactionType type, float amount, string clientAddress) { DateTime authenticationDateTime; _authenticatedClients.TryGetValue(clientAddress, out authenticationDateTime); if (authenticationDateTime == null) { return(false); } if (type == TransactionType.Deposit) { return(AccountRepository.AdjustAccountBalance(amount)); } else if (type == TransactionType.Withdraw) { // Multiply by -1 because we're removing money from the account return(AccountRepository.AdjustAccountBalance(amount * -1)); } // If we get here, something went wrong on the client side return(false); }