diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBankruptDatabaseImplement.csproj b/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBankruptDatabaseImplement.csproj index dcbe30c..7e5a9a6 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBankruptDatabaseImplement.csproj +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBankruptDatabaseImplement.csproj @@ -6,10 +6,6 @@ enable - - - - diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/AccountStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/AccountStorage.cs new file mode 100644 index 0000000..5381f9f --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/AccountStorage.cs @@ -0,0 +1,43 @@ +using BankYouBankruptContracts.BindingModels; +using BankYouBankruptContracts.SearchModels; +using BankYouBankruptContracts.StoragesContracts; +using BankYouBankruptContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankYouBankruptDatabaseImplement.Implements +{ + public class AccountStorage : IAccountStorage + { + public List GetFullList() + { + throw new NotImplementedException(); + } + + public List GetFilteredList(AccountSearchModel model) + { + throw new NotImplementedException(); + } + public AccountViewModel? GetElement(AccountSearchModel model) + { + throw new NotImplementedException(); + } + + public AccountViewModel? Insert(AccountBindingModel model) + { + throw new NotImplementedException(); + } + + public AccountViewModel? Update(AccountBindingModel model) + { + throw new NotImplementedException(); + } + public AccountViewModel? Delete(AccountBindingModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Account.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Account.cs index d87bea9..0015564 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Account.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Account.cs @@ -25,6 +25,9 @@ namespace BankYouBankruptDatabaseImplement.Models [Required] public int ClientId { get; set; } + //для передачи ФИО клиента + public virtual Client Client { get; set; } + [Required] public string PasswordAccount { get; set; } = string.Empty; @@ -45,12 +48,17 @@ namespace BankYouBankruptDatabaseImplement.Models [ForeignKey("AccountPayeeId")] public virtual List MoneyTransferPayees { get; set; } = new(); + //для реализации связи один ко многим с Картами + [ForeignKey("AccountId")] + public virtual List Cards { get; set; } = new(); + public static Account Create(BankYouBancruptDatabase context, AccountBindingModel model) { return new Account() { Id = model.Id, ClientId = model.ClientId, + Client = context.Clients.First(x => x.Id == model.ClientId), PasswordAccount = model.PasswordAccount, Balance = model.Balance, DateOpen = model.DateOpen, diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs index ca27379..a5f0f14 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs @@ -18,6 +18,9 @@ namespace BankYouBankruptDatabaseImplement.Models [Required] public int AccountId { get; set; } + //для передачи названия изделия + public virtual Account Account { get; set; } + [Required] public int Sum { get; set; } @@ -30,6 +33,7 @@ namespace BankYouBankruptDatabaseImplement.Models { Id = model.Id, AccountId = model.AccountId, + Account = context.Accounts.First(x => x.Id == model.AccountId), Sum = model.Sum, DateOperation = model.DateOperation }; diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs index c7aec11..51c8766 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs @@ -21,9 +21,15 @@ namespace BankYouBankruptDatabaseImplement.Models [Required] public int AccountSenderId { get; set; } + //для передачи номера счёта отправителя + public virtual Account AccountSenderNumber { get; set; } + [Required] public int AccountPayeeId { get; set; } + //для передачи номера счёта получателя + public virtual Account AccountPayeeNumber { get; set; } + [Required] public DateTime DateOperation { get; set; } @@ -35,7 +41,9 @@ namespace BankYouBankruptDatabaseImplement.Models Sum = model.Sum, AccountSenderId = model.AccountSenderId, AccountPayeeId = model.AccountPayeeId, - DateOperation = model.DateOperation + DateOperation = model.DateOperation, + AccountSenderNumber = context.Accounts.First(x => x.Id == model.AccountSenderId), + AccountPayeeNumber = context.Accounts.First(x => x.Id == model.AccountPayeeId) }; }