Removed pass by reference

This commit is contained in:
Stedd 2022-02-12 14:55:15 +01:00
parent 3f833429c8
commit 19b6012717
2 changed files with 4 additions and 14 deletions

View File

@ -10,7 +10,7 @@ namespace CryptoCalc
{
public class DBInteraction
{
public static void SaveData<T>(ref T data) where T : DBClasses
public static void SaveData<T>(T data) where T : DBClasses
{
if (data is null)
{

View File

@ -22,19 +22,16 @@ namespace CryptoCalc
private void saveButton_Click(object sender, RoutedEventArgs e)
{
genericT = DummyTransaction();
DBInteraction.SaveData(ref genericT);
DBInteraction.SaveData(DummyTransaction());
}
private void saveWalletButton_Click(object sender, RoutedEventArgs e)
{
genericW = DummyWallet();
DBInteraction.SaveData(ref genericW);
DBInteraction.SaveData(DummyWallet());
}
private void saveButtonFromInput_Click(object sender, RoutedEventArgs e)
{
genericT = new(inputCurrency.Text, Convert.ToSingle(inputAmount.Text), inputType.Text);
DBInteraction.SaveData(ref genericT);
DBInteraction.SaveData(new Transaction(inputCurrency.Text, Convert.ToSingle(inputAmount.Text), inputType.Text));
}
private void readButton_click(object sender, RoutedEventArgs e)
@ -49,7 +46,6 @@ namespace CryptoCalc
{
string query = $"SELECT * from {genericT.DBTableName} WHERE {nameof(genericT.Currency)}=\'{currencyText.Text}\'";
IEnumerable<Transaction> transactions = transactionDB.QueryData(genericT.DBTableName, query);
//transactions = DBInteraction.LoadTransactionsOfCurrency(currencyText.Text);
transactionsFoundListBox.Items.Clear();
foreach (Transaction x in transactions)
{
@ -57,12 +53,6 @@ namespace CryptoCalc
}
}
//private IEnumerable<Transaction> ReadTransactionFromDB()
//{
// Transaction t = new();
// return transactionDB.LoadAllData(t.DBTableName);
//}
private Transaction DummyTransaction()
{
Transaction t = new();