Правки в Models в DatebaseImplemets у кассира.

This commit is contained in:
Programmist73 2023-04-01 20:49:00 +04:00
parent 7494228685
commit f70031d58e
5 changed files with 64 additions and 5 deletions

View File

@ -6,10 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" 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]
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<MoneyTransfer> MoneyTransferPayees { get; set; } = new();
//для реализации связи один ко многим с Картами
[ForeignKey("AccountId")]
public virtual List<Card> 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,

View File

@ -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
};

View File

@ -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)
};
}