Добавил интерфейс бизнес-логики, SearchModel, и Vie-шки, немного с бд поработал
This commit is contained in:
parent
abb4a21c4a
commit
800865a3a5
@ -11,10 +11,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="ViewModels\" />
|
|
||||||
<Folder Include="SearchModels\" />
|
|
||||||
<Folder Include="StoragesModels\" />
|
<Folder Include="StoragesModels\" />
|
||||||
<Folder Include="BusinessLogicsContracts\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
26
Bank/BankContracts/BusinessLogicsContracts/IAccountLogic.cs
Normal file
26
Bank/BankContracts/BusinessLogicsContracts/IAccountLogic.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IAccountLogic
|
||||||
|
{
|
||||||
|
List<AccountViewModel>? ReadList(AccountSearchModel? model);
|
||||||
|
|
||||||
|
AccountViewModel? ReadElement(AccountSearchModel model);
|
||||||
|
|
||||||
|
bool ChangeBalance(AccountSearchModel? model, int sum);
|
||||||
|
|
||||||
|
bool Create(AccountBindingModel model);
|
||||||
|
|
||||||
|
bool Update(AccountBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(AccountBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
24
Bank/BankContracts/BusinessLogicsContracts/ICardLogic.cs
Normal file
24
Bank/BankContracts/BusinessLogicsContracts/ICardLogic.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface ICardLogic
|
||||||
|
{
|
||||||
|
List<CardViewModel>? ReadList(CardSearchModel? model);
|
||||||
|
|
||||||
|
CardViewModel? ReadElement(CardSearchModel model);
|
||||||
|
|
||||||
|
bool Create(CardBindingModel model);
|
||||||
|
|
||||||
|
bool Update(CardBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(CardBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
24
Bank/BankContracts/BusinessLogicsContracts/ICashierLogic.cs
Normal file
24
Bank/BankContracts/BusinessLogicsContracts/ICashierLogic.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface ICashierLogic
|
||||||
|
{
|
||||||
|
List<CashierViewModel>? ReadList(CashierSearchModel? model);
|
||||||
|
|
||||||
|
CashierViewModel? ReadElement(CashierSearchModel model);
|
||||||
|
|
||||||
|
bool Create(CashierBindingModel model);
|
||||||
|
|
||||||
|
bool Update(CashierBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(CashierBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
24
Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs
Normal file
24
Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IClientLogic
|
||||||
|
{
|
||||||
|
List<ClientViewModel>? ReadList(ClientSearchModel? model);
|
||||||
|
|
||||||
|
ClientViewModel? ReadElement(ClientSearchModel model);
|
||||||
|
|
||||||
|
bool Create(ClientBindingModel model);
|
||||||
|
|
||||||
|
bool Update(ClientBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(ClientBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
26
Bank/BankContracts/SearchModels/AccountSearchModel.cs
Normal file
26
Bank/BankContracts/SearchModels/AccountSearchModel.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using BankDataModels.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class AccountSearchModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int CashierId { get; set; }
|
||||||
|
|
||||||
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
|
public string AccountNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public double Balance { get; set; }
|
||||||
|
|
||||||
|
public DateTime DateOpen { get; set; }
|
||||||
|
|
||||||
|
public StatusAccount StatusAccount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
27
Bank/BankContracts/SearchModels/CardSearchModel.cs
Normal file
27
Bank/BankContracts/SearchModels/CardSearchModel.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using BankDataModels.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class CardSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public int? ClientID { get; set; }
|
||||||
|
|
||||||
|
public int? AccountId { get; set; }
|
||||||
|
|
||||||
|
// Номер банковской карты
|
||||||
|
public string? Number { get; set; }
|
||||||
|
|
||||||
|
public double Balance { get; set; }
|
||||||
|
|
||||||
|
public DateTime Period { get; set; }
|
||||||
|
|
||||||
|
public StatusCard StatusCard { get; set; }
|
||||||
|
}
|
||||||
|
}
|
25
Bank/BankContracts/SearchModels/CashierSearchModel.cs
Normal file
25
Bank/BankContracts/SearchModels/CashierSearchModel.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class CashierSearchModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Surname { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Patronymic { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string MobilePhone { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
25
Bank/BankContracts/SearchModels/ClientSearchModel.cs
Normal file
25
Bank/BankContracts/SearchModels/ClientSearchModel.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class ClientSearchModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Surname { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Patronymic { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string MobilePhone { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
41
Bank/BankContracts/ViewModels/AccountViewModel.cs
Normal file
41
Bank/BankContracts/ViewModels/AccountViewModel.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using BankDataModels.Enums;
|
||||||
|
using BankDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class AccountViewModel : IAccountModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int CashierId { get; set; }
|
||||||
|
|
||||||
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Номер счёта")]
|
||||||
|
public string AccountNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Баланс")]
|
||||||
|
public double Balance { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата открытия")]
|
||||||
|
public DateTime DateOpen { get; set; } = DateTime.Now; // ИЛИ ТУТ СРОК ДЕЙСТВИЯ СЧЁТА???
|
||||||
|
|
||||||
|
[DisplayName("Статус счёта")]
|
||||||
|
public StatusAccount StatusAccount { get; set; } = StatusAccount.Закрыт;
|
||||||
|
|
||||||
|
// ВОЗМОЖНО ПОНАДОБИТЬСЯ ДЛЯ ОТЧЁТОВ
|
||||||
|
//[DisplayName("Имя")]
|
||||||
|
//public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
//[DisplayName("Отчество")]
|
||||||
|
//public string Patronymic { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
//public string PasswordAccount { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
36
Bank/BankContracts/ViewModels/CardViewModel.cs
Normal file
36
Bank/BankContracts/ViewModels/CardViewModel.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using BankDataModels.Enums;
|
||||||
|
using BankDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class CardViewModel : ICardModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
|
public int AccountId { get; set; }
|
||||||
|
|
||||||
|
// Номер банковской карты
|
||||||
|
[DisplayName("Номер карты")]
|
||||||
|
public string Number { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Баланс карты")]
|
||||||
|
public double Balance { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Срок действия")]
|
||||||
|
public DateTime Period { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
[DisplayName("Статус карты")]
|
||||||
|
public StatusCard StatusCard { get; set; } = StatusCard.Закрыта;
|
||||||
|
|
||||||
|
[DisplayName("Фамилия клиента")]
|
||||||
|
public string? ClientSurname { get; set; }
|
||||||
|
}
|
||||||
|
}
|
33
Bank/BankContracts/ViewModels/CashierViewModel.cs
Normal file
33
Bank/BankContracts/ViewModels/CashierViewModel.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using BankDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class CashierViewModel : ICashierModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Имя")]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Фамилия")]
|
||||||
|
public string Surname { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Отчество")]
|
||||||
|
public string Patronymic { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Почта")]
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Пароль")]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Телефон")]
|
||||||
|
public string MobilePhone { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
33
Bank/BankContracts/ViewModels/ClientViewModel.cs
Normal file
33
Bank/BankContracts/ViewModels/ClientViewModel.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using BankDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ClientViewModel : IClientModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Имя")]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Фамилия")]
|
||||||
|
public string Surname { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Отчество")]
|
||||||
|
public string Patronymic { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Почта")]
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Пароль")]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Телефон")]
|
||||||
|
public string MobilePhone { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
21
Bank/BankDatabaseImplement/BankDatabase.cs
Normal file
21
Bank/BankDatabaseImplement/BankDatabase.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankDatabaseImplement
|
||||||
|
{
|
||||||
|
public class BankDatabase : DbContext
|
||||||
|
{
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
if (optionsBuilder.IsConfigured == false)
|
||||||
|
{
|
||||||
|
optionsBuilder.UseSqlServer(@"Data Source= \SQLEXPRESS;Initial Catalog=BankDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
|
}
|
||||||
|
base.OnConfiguring(optionsBuilder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,4 +6,13 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.18" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.18">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
namespace BankDatabaseImplement
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user