diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs index e06c7f4..da3d8c4 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs @@ -20,6 +20,7 @@ namespace BankYouBankruptDatabaseImplement.Implements using var context = new BankYouBancruptDatabase(); return context.Creditings + .Include(x => x.Card) .Select(x => x.GetViewModel) .ToList(); } @@ -34,7 +35,7 @@ namespace BankYouBankruptDatabaseImplement.Implements using var context = new BankYouBancruptDatabase(); return context.Creditings - .Where(x => x.CardId == model.CardId) + .Include(x => x.Card) .Select(x => x.GetViewModel) .ToList(); } @@ -49,8 +50,8 @@ namespace BankYouBankruptDatabaseImplement.Implements using var context = new BankYouBancruptDatabase(); return context.Creditings - .FirstOrDefault(x => (!(model.CardId < 0) && x.CardId == model.CardId) || - (model.Id.HasValue && x.Id == model.Id)) + .Include(x => x.Card) + .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; } diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/MoneyTransferStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/MoneyTransferStorage.cs index 6faa59b..693bf2e 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/MoneyTransferStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/MoneyTransferStorage.cs @@ -19,6 +19,9 @@ namespace BankYouBankruptDatabaseImplement.Implements using var context = new BankYouBancruptDatabase(); return context.MoneyTransfers + .Include(x => x.AccountPayeer) + .Include(x => x.AccountSender) + .Include(x => x.Cashier) .Select(x => x.GetViewModel) .ToList(); } @@ -33,6 +36,9 @@ namespace BankYouBankruptDatabaseImplement.Implements using var context = new BankYouBancruptDatabase(); return context.MoneyTransfers + .Include(x => x.AccountPayeer) + .Include(x => x.AccountSender) + .Include(x => x.Cashier) .Where(x => x.AccountSenderId == model.AccountSenderId) .Select(x => x.GetViewModel) .ToList(); @@ -48,9 +54,10 @@ namespace BankYouBankruptDatabaseImplement.Implements using var context = new BankYouBancruptDatabase(); return context.MoneyTransfers - .FirstOrDefault(x => (!(model.AccountSenderId < 0) && x.AccountSenderId == model.AccountSenderId - && x.AccountPayeeId == model.AccountPayeeId && x.DateOperation == x.DateOperation - && x.Sum == model.Sum) || (model.Id.HasValue && x.Id == model.Id)) + .Include(x => x.AccountPayeer) + .Include(x => x.AccountSender) + .Include(x => x.Cashier) + .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; }