DatabaseImplement

This commit is contained in:
shadowik 2023-04-01 15:33:39 +04:00
parent 48c022bec8
commit db7b5513db
14 changed files with 226 additions and 8 deletions

View File

@ -51,7 +51,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. ClientFio:{ClientFio}.Id:{ Id}", model.ClientFIO, model.Id);
_logger.LogInformation("ReadElement. Name:{Name}.Surname:{Surname}.Patronymic:{Patronymic}.Id:{ Id}", model.Name, model.Surname, model.Patronymic, model.Id);
var element = _clientStorage.GetElement(model);
if (element == null)
{

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BankYouBankruptContracts.BindingModels
{
public class ClientBindingModel : IСlientModel
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace BankYouBankruptContracts.ViewModels
{
public class ClientViewModel : IСlientModel
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
public string Password { get; set; } = string.Empty;

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BankYouBankruptDataModels.Models
{
//клиент
public interface IСlientModel : IId
public interface IClientModel : IId
{
string Password { get; }

View File

@ -1,12 +1,33 @@
using System;
using BankYouBankruptDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement
{
public class BankYouBancruptDatabase
public class BankYouBancruptDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlServer(@"Data Source=SHADOWIK\SHADOWIK;Initial Catalog=PizzeriaDatabase;Integrated Security=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Account> Accounts { set; get; }
public virtual DbSet<Card> Cards { set; get; }
public virtual DbSet<Cashier> Cashiers { set; get; }
public virtual DbSet<CashWithdrawal> CashWithdrawals { set; get; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Debiting> Debitings { set; get; }
public virtual DbSet<Crediting> Creditings { set; get; }
public virtual DbSet<MoneyTransfer> MoneyTransfers { set; get; }
}
}

View File

@ -7,8 +7,21 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="Implements\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BankYouBankruptContracts\BankYouBankruptContracts.csproj" />
<ProjectReference Include="..\BankYouBankruptDataModels\BankYouBankruptDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class Account : IAccountModel
{
public string AccountNumber => throw new NotImplementedException();
public int CashierId => throw new NotImplementedException();
public int ClientId => throw new NotImplementedException();
public string PasswordAccount => throw new NotImplementedException();
public double Balance => throw new NotImplementedException();
public DateTime DateOpen => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,24 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class Card : ICardModel
{
public int ClientID => throw new NotImplementedException();
public int AccountId => throw new NotImplementedException();
public string Number => throw new NotImplementedException();
public string CVC => throw new NotImplementedException();
public DateTime Period => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,20 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class CashWithdrawal : ICashWithdrawalModel
{
public int AccountId => throw new NotImplementedException();
public int Sum => throw new NotImplementedException();
public DateTime DateOperation => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,26 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class Cashier : ICashierModel
{
public string Password => throw new NotImplementedException();
public string Name => throw new NotImplementedException();
public string Surname => throw new NotImplementedException();
public string Patronymic => throw new NotImplementedException();
public string Email => throw new NotImplementedException();
public string Telephone => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,26 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class Client : IClientModel
{
public string Password => throw new NotImplementedException();
public string Name => throw new NotImplementedException();
public string Surname => throw new NotImplementedException();
public string Patronymic => throw new NotImplementedException();
public string Email => throw new NotImplementedException();
public string Telephone => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,20 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class Crediting : ICreditingModel
{
public int CardId => throw new NotImplementedException();
public int Sum => throw new NotImplementedException();
public DateTime date => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,20 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class Debiting : IDebitingModel
{
public int CardId => throw new NotImplementedException();
public int Sum => throw new NotImplementedException();
public DateTime date => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}

View File

@ -0,0 +1,22 @@
using BankYouBankruptDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement.Models
{
public class MoneyTransfer : IMoneyTransferModel
{
public int Sum => throw new NotImplementedException();
public int AccountSenderId => throw new NotImplementedException();
public int AccountPayeeId => throw new NotImplementedException();
public DateTime DateOperation => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
}
}