This commit is contained in:
shadowik 2023-04-01 16:49:29 +04:00
commit 016b57d5b8
5 changed files with 64 additions and 5 deletions

View File

@ -6,10 +6,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />

View File

@ -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<AccountViewModel> GetFullList()
{
throw new NotImplementedException();
}
public List<AccountViewModel> 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();
}
}
}

View File

@ -25,6 +25,9 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required] [Required]
public int ClientId { get; set; } public int ClientId { get; set; }
//для передачи ФИО клиента
public virtual Client Client { get; set; }
[Required] [Required]
public string PasswordAccount { get; set; } = string.Empty; public string PasswordAccount { get; set; } = string.Empty;
@ -45,12 +48,17 @@ namespace BankYouBankruptDatabaseImplement.Models
[ForeignKey("AccountPayeeId")] [ForeignKey("AccountPayeeId")]
public virtual List<MoneyTransfer> MoneyTransferPayees { get; set; } = new(); public virtual List<MoneyTransfer> MoneyTransferPayees { get; set; } = new();
//для реализации связи один ко многим с Картами
[ForeignKey("AccountId")]
public virtual List<Card> Cards { get; set; } = new();
public static Account Create(BankYouBancruptDatabase context, AccountBindingModel model) public static Account Create(BankYouBancruptDatabase context, AccountBindingModel model)
{ {
return new Account() return new Account()
{ {
Id = model.Id, Id = model.Id,
ClientId = model.ClientId, ClientId = model.ClientId,
Client = context.Clients.First(x => x.Id == model.ClientId),
PasswordAccount = model.PasswordAccount, PasswordAccount = model.PasswordAccount,
Balance = model.Balance, Balance = model.Balance,
DateOpen = model.DateOpen, DateOpen = model.DateOpen,

View File

@ -18,6 +18,9 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required] [Required]
public int AccountId { get; set; } public int AccountId { get; set; }
//для передачи названия изделия
public virtual Account Account { get; set; }
[Required] [Required]
public int Sum { get; set; } public int Sum { get; set; }
@ -30,6 +33,7 @@ namespace BankYouBankruptDatabaseImplement.Models
{ {
Id = model.Id, Id = model.Id,
AccountId = model.AccountId, AccountId = model.AccountId,
Account = context.Accounts.First(x => x.Id == model.AccountId),
Sum = model.Sum, Sum = model.Sum,
DateOperation = model.DateOperation DateOperation = model.DateOperation
}; };

View File

@ -21,9 +21,15 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required] [Required]
public int AccountSenderId { get; set; } public int AccountSenderId { get; set; }
//для передачи номера счёта отправителя
public virtual Account AccountSenderNumber { get; set; }
[Required] [Required]
public int AccountPayeeId { get; set; } public int AccountPayeeId { get; set; }
//для передачи номера счёта получателя
public virtual Account AccountPayeeNumber { get; set; }
[Required] [Required]
public DateTime DateOperation { get; set; } public DateTime DateOperation { get; set; }
@ -35,7 +41,9 @@ namespace BankYouBankruptDatabaseImplement.Models
Sum = model.Sum, Sum = model.Sum,
AccountSenderId = model.AccountSenderId, AccountSenderId = model.AccountSenderId,
AccountPayeeId = model.AccountPayeeId, 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)
}; };
} }