From 2b05baa78a1106f52fd8f5e3fffbf8ffc73e7b2b Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Thu, 25 Apr 2024 21:31:07 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=BE=D0=B2=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bank/BankContracts/BankContracts.csproj | 6 +--- .../BindingModels/CardBindingModel.cs | 21 +++++++++++++ .../BindingModels/ClientBindingModel.cs | 17 ++++++++++ .../BindingModels/OperationBindingModel.cs | 18 +++++++++++ .../BindingModels/RequestBindingModel.cs | 17 ++++++++++ .../BusinessLogicsContracts/ICardLogic.cs | 20 ++++++++++++ .../BusinessLogicsContracts/IClientLogic.cs | 20 ++++++++++++ .../IOperationLogic.cs | 20 ++++++++++++ .../BusinessLogicsContracts/IRequestLogic.cs | 22 +++++++++++++ .../SearchModels/CardSearchModel.cs | 15 +++++++++ .../SearchModels/ClientSearchModel.cs | 16 ++++++++++ .../SearchModels/OperationSearchModel.cs | 15 +++++++++ .../SearchModels/RequestSearchModel.cs | 16 ++++++++++ .../StoragesContracts/ICardStorage.cs | 21 +++++++++++++ .../StoragesContracts/IClientStorage.cs | 21 +++++++++++++ .../StoragesContracts/IOperationStorage.cs | 21 +++++++++++++ .../StoragesContracts/IRequestStorage.cs | 21 +++++++++++++ .../BankContracts/ViewModels/CardViewModel.cs | 31 +++++++++++++++++++ .../ViewModels/ClientViewModel.cs | 21 +++++++++++++ .../ViewModels/OperationViewModel.cs | 25 +++++++++++++++ .../ViewModels/RequestViewModel.cs | 21 +++++++++++++ Bank/BankDataModels/Models/IClientModel.cs | 6 ++-- Bank/BankDataModels/Models/IOperationModel.cs | 6 ++-- 23 files changed, 406 insertions(+), 11 deletions(-) create mode 100644 Bank/BankContracts/BindingModels/CardBindingModel.cs create mode 100644 Bank/BankContracts/BindingModels/ClientBindingModel.cs create mode 100644 Bank/BankContracts/BindingModels/OperationBindingModel.cs create mode 100644 Bank/BankContracts/BindingModels/RequestBindingModel.cs create mode 100644 Bank/BankContracts/BusinessLogicsContracts/ICardLogic.cs create mode 100644 Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs create mode 100644 Bank/BankContracts/BusinessLogicsContracts/IOperationLogic.cs create mode 100644 Bank/BankContracts/BusinessLogicsContracts/IRequestLogic.cs create mode 100644 Bank/BankContracts/SearchModels/CardSearchModel.cs create mode 100644 Bank/BankContracts/SearchModels/ClientSearchModel.cs create mode 100644 Bank/BankContracts/SearchModels/OperationSearchModel.cs create mode 100644 Bank/BankContracts/SearchModels/RequestSearchModel.cs create mode 100644 Bank/BankContracts/StoragesContracts/ICardStorage.cs create mode 100644 Bank/BankContracts/StoragesContracts/IClientStorage.cs create mode 100644 Bank/BankContracts/StoragesContracts/IOperationStorage.cs create mode 100644 Bank/BankContracts/StoragesContracts/IRequestStorage.cs create mode 100644 Bank/BankContracts/ViewModels/CardViewModel.cs create mode 100644 Bank/BankContracts/ViewModels/ClientViewModel.cs create mode 100644 Bank/BankContracts/ViewModels/OperationViewModel.cs create mode 100644 Bank/BankContracts/ViewModels/RequestViewModel.cs diff --git a/Bank/BankContracts/BankContracts.csproj b/Bank/BankContracts/BankContracts.csproj index 277327b..f8f2521 100644 --- a/Bank/BankContracts/BankContracts.csproj +++ b/Bank/BankContracts/BankContracts.csproj @@ -7,11 +7,7 @@ - - - - - + diff --git a/Bank/BankContracts/BindingModels/CardBindingModel.cs b/Bank/BankContracts/BindingModels/CardBindingModel.cs new file mode 100644 index 0000000..f3f40c2 --- /dev/null +++ b/Bank/BankContracts/BindingModels/CardBindingModel.cs @@ -0,0 +1,21 @@ +using BankDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankContracts.BindingModels +{ + public class CardBindingModel : ICardModel + { + public int Id { get; set; } + public string Number { get; set; } = string.Empty; + public string Cvv { get; set; } = string.Empty; + public string Pin { get; set; } = string.Empty; + public DateOnly ReleaseDate { get; set; } + public DateOnly ExpirationDate { get; set; } + public int ClientId { get; set; } + public int? AccountId { get; set; } + } +} diff --git a/Bank/BankContracts/BindingModels/ClientBindingModel.cs b/Bank/BankContracts/BindingModels/ClientBindingModel.cs new file mode 100644 index 0000000..b715793 --- /dev/null +++ b/Bank/BankContracts/BindingModels/ClientBindingModel.cs @@ -0,0 +1,17 @@ +using BankDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankContracts.BindingModels +{ + public class ClientBindingModel : IClientModel + { + public int Id { get; set; } + public string Fio { get; set; } = string.Empty; + public string Email { get; set; } = string.Empty; + public string Password { get; set; } = string.Empty; + } +} diff --git a/Bank/BankContracts/BindingModels/OperationBindingModel.cs b/Bank/BankContracts/BindingModels/OperationBindingModel.cs new file mode 100644 index 0000000..683e6ad --- /dev/null +++ b/Bank/BankContracts/BindingModels/OperationBindingModel.cs @@ -0,0 +1,18 @@ +using BankDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankContracts.BindingModels +{ + public class OperationBindingModel : IOperationModel + { + public int Id { get; set; } + public int Sum { get; set; } + public DateTime OperationTime { get; set; } + public int? SenderCardId { get; set; } + public int RecipientCardId { get; set; } + } +} diff --git a/Bank/BankContracts/BindingModels/RequestBindingModel.cs b/Bank/BankContracts/BindingModels/RequestBindingModel.cs new file mode 100644 index 0000000..c923f68 --- /dev/null +++ b/Bank/BankContracts/BindingModels/RequestBindingModel.cs @@ -0,0 +1,17 @@ +using BankDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankContracts.BindingModels +{ + public class RequestBindingModel : IRequestModel + { + public int Id { get; set; } + public int Sum { get; set; } + public DateTime RequestTime { get; set; } + public RequestStatus Status { get; set; } + } +} diff --git a/Bank/BankContracts/BusinessLogicsContracts/ICardLogic.cs b/Bank/BankContracts/BusinessLogicsContracts/ICardLogic.cs new file mode 100644 index 0000000..b53ce91 --- /dev/null +++ b/Bank/BankContracts/BusinessLogicsContracts/ICardLogic.cs @@ -0,0 +1,20 @@ +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? ReadList(CardSearchModel? model); + CardViewModel? ReadElement(CardSearchModel model); + bool Create(CardBindingModel model); + bool Update(CardBindingModel model); + bool Delete(CardBindingModel model); + } +} diff --git a/Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs b/Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs new file mode 100644 index 0000000..7ddda2d --- /dev/null +++ b/Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs @@ -0,0 +1,20 @@ +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? ReadList(ClientSearchModel? model); + ClientViewModel? ReadElement(ClientSearchModel model); + bool Create(ClientBindingModel model); + bool Update(ClientBindingModel model); + bool Delete(ClientBindingModel model); + } +} diff --git a/Bank/BankContracts/BusinessLogicsContracts/IOperationLogic.cs b/Bank/BankContracts/BusinessLogicsContracts/IOperationLogic.cs new file mode 100644 index 0000000..f46604e --- /dev/null +++ b/Bank/BankContracts/BusinessLogicsContracts/IOperationLogic.cs @@ -0,0 +1,20 @@ +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 IOperationLogic + { + List? ReadList(OperationSearchModel? model); + OperationViewModel? ReadElement(OperationSearchModel model); + bool Create(OperationBindingModel model); + bool Update(OperationBindingModel model); + bool Delete(OperationBindingModel model); + } +} diff --git a/Bank/BankContracts/BusinessLogicsContracts/IRequestLogic.cs b/Bank/BankContracts/BusinessLogicsContracts/IRequestLogic.cs new file mode 100644 index 0000000..0207741 --- /dev/null +++ b/Bank/BankContracts/BusinessLogicsContracts/IRequestLogic.cs @@ -0,0 +1,22 @@ +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 IRequestLogic + { + List? ReadList(RequestSearchModel? model); + RequestViewModel? ReadElement(RequestSearchModel model); + bool Create(RequestBindingModel model); + bool Update(RequestBindingModel model); + bool Delete(RequestBindingModel model); + bool DeclineRequest(RequestBindingModel model); + bool SatisfyRequest(RequestBindingModel model); + } +} diff --git a/Bank/BankContracts/SearchModels/CardSearchModel.cs b/Bank/BankContracts/SearchModels/CardSearchModel.cs new file mode 100644 index 0000000..e154736 --- /dev/null +++ b/Bank/BankContracts/SearchModels/CardSearchModel.cs @@ -0,0 +1,15 @@ +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 string? Number { get; set; } + public int? ClientId { get; set; } + } +} diff --git a/Bank/BankContracts/SearchModels/ClientSearchModel.cs b/Bank/BankContracts/SearchModels/ClientSearchModel.cs new file mode 100644 index 0000000..d61b2ae --- /dev/null +++ b/Bank/BankContracts/SearchModels/ClientSearchModel.cs @@ -0,0 +1,16 @@ +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? Fio { get; set; } + public string? Email { get; set; } + public string? Password { get; set; } + } +} diff --git a/Bank/BankContracts/SearchModels/OperationSearchModel.cs b/Bank/BankContracts/SearchModels/OperationSearchModel.cs new file mode 100644 index 0000000..f532a3d --- /dev/null +++ b/Bank/BankContracts/SearchModels/OperationSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankContracts.SearchModels +{ + public class OperationSearchModel + { + public int? Id { get; set; } + public DateTime? OperationTime { get; set; } + public int? RecipientCardId { get; set; } + } +} diff --git a/Bank/BankContracts/SearchModels/RequestSearchModel.cs b/Bank/BankContracts/SearchModels/RequestSearchModel.cs new file mode 100644 index 0000000..7812db3 --- /dev/null +++ b/Bank/BankContracts/SearchModels/RequestSearchModel.cs @@ -0,0 +1,16 @@ +using BankDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankContracts.SearchModels +{ + public class RequestSearchModel + { + public int? Id { get; set; } + public DateTime? RequestTime { get; set; } + public string? CardNumber { get; set; } + } +} diff --git a/Bank/BankContracts/StoragesContracts/ICardStorage.cs b/Bank/BankContracts/StoragesContracts/ICardStorage.cs new file mode 100644 index 0000000..3f1fce7 --- /dev/null +++ b/Bank/BankContracts/StoragesContracts/ICardStorage.cs @@ -0,0 +1,21 @@ +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.StoragesContracts +{ + public interface ICardStorage + { + List GetFullList(); + List GetFilteredList(CardSearchModel model); + CardViewModel? GetElement(CardSearchModel model); + CardViewModel? Insert(CardBindingModel model); + CardViewModel? Update(CardBindingModel model); + CardViewModel? Delete(CardBindingModel model); + } +} diff --git a/Bank/BankContracts/StoragesContracts/IClientStorage.cs b/Bank/BankContracts/StoragesContracts/IClientStorage.cs new file mode 100644 index 0000000..9e8f762 --- /dev/null +++ b/Bank/BankContracts/StoragesContracts/IClientStorage.cs @@ -0,0 +1,21 @@ +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.StoragesContracts +{ + public interface IClientStorage + { + List GetFullList(); + List GetFilteredList(ClientSearchModel model); + ClientViewModel? GetElement(ClientSearchModel model); + ClientViewModel? Insert(ClientBindingModel model); + ClientViewModel? Update(ClientBindingModel model); + ClientViewModel? Delete(ClientBindingModel model); + } +} diff --git a/Bank/BankContracts/StoragesContracts/IOperationStorage.cs b/Bank/BankContracts/StoragesContracts/IOperationStorage.cs new file mode 100644 index 0000000..cd47eec --- /dev/null +++ b/Bank/BankContracts/StoragesContracts/IOperationStorage.cs @@ -0,0 +1,21 @@ +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.StoragesContracts +{ + public interface IOperationStorage + { + List GetFullList(); + List GetFilteredList(OperationSearchModel model); + OperationViewModel? GetElement(OperationSearchModel model); + OperationViewModel? Insert(OperationBindingModel model); + OperationViewModel? Update(OperationBindingModel model); + OperationViewModel? Delete(OperationBindingModel model); + } +} diff --git a/Bank/BankContracts/StoragesContracts/IRequestStorage.cs b/Bank/BankContracts/StoragesContracts/IRequestStorage.cs new file mode 100644 index 0000000..aa96562 --- /dev/null +++ b/Bank/BankContracts/StoragesContracts/IRequestStorage.cs @@ -0,0 +1,21 @@ +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.StoragesContracts +{ + public interface IRequestStorage + { + List GetFullList(); + List GetFilteredList(RequestSearchModel model); + RequestViewModel? GetElement(RequestSearchModel model); + RequestViewModel? Insert(RequestBindingModel model); + RequestViewModel? Update(RequestBindingModel model); + RequestViewModel? Delete(RequestBindingModel model); + } +} diff --git a/Bank/BankContracts/ViewModels/CardViewModel.cs b/Bank/BankContracts/ViewModels/CardViewModel.cs new file mode 100644 index 0000000..41e77a3 --- /dev/null +++ b/Bank/BankContracts/ViewModels/CardViewModel.cs @@ -0,0 +1,31 @@ +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; } + [DisplayName("Номер карты")] + public string Number { get; set; } = string.Empty; + [DisplayName("CVV-код")] + public string Cvv { get; set; } = string.Empty; + [DisplayName("PIN-код")] + public string Pin { get; set; } = string.Empty; + [DisplayName("Дата выпуска")] + public DateOnly ReleaseDate { get; set; } + [DisplayName("Дата окончания действия")] + public DateOnly ExpirationDate { get; set; } + public int ClientId { get; set; } + [DisplayName("Держатель карты")] + public string ClientName { get; set; } = string.Empty; + public int? AccountId { get; set; } + [DisplayName("")] + public string AccountNumber { get; set; } = string.Empty; + } +} diff --git a/Bank/BankContracts/ViewModels/ClientViewModel.cs b/Bank/BankContracts/ViewModels/ClientViewModel.cs new file mode 100644 index 0000000..75365dc --- /dev/null +++ b/Bank/BankContracts/ViewModels/ClientViewModel.cs @@ -0,0 +1,21 @@ +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 Fio { get; set; } = string.Empty; + [DisplayName("Почта")] + public string Email { get; set; } = string.Empty; + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + } +} diff --git a/Bank/BankContracts/ViewModels/OperationViewModel.cs b/Bank/BankContracts/ViewModels/OperationViewModel.cs new file mode 100644 index 0000000..b979b39 --- /dev/null +++ b/Bank/BankContracts/ViewModels/OperationViewModel.cs @@ -0,0 +1,25 @@ +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 OperationViewModel : IOperationModel + { + public int Id { get; set; } + [DisplayName("Сумма пополнения")] + public int Sum { get; set; } + [DisplayName("Время выполнения")] + public DateTime OperationTime { get; set; } + public int? SenderCardId { get; set; } + [DisplayName("Номер карты отправителя")] + public string SenderCardNumber { get; set; } = string.Empty; + public int RecipientCardId { get; set; } + [DisplayName("Номер карты получателя")] + public string RecipientCardNumber { get; set; } = string.Empty; + } +} diff --git a/Bank/BankContracts/ViewModels/RequestViewModel.cs b/Bank/BankContracts/ViewModels/RequestViewModel.cs new file mode 100644 index 0000000..22a022f --- /dev/null +++ b/Bank/BankContracts/ViewModels/RequestViewModel.cs @@ -0,0 +1,21 @@ +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 RequestViewModel : IRequestModel + { + public int Id { get; set; } + [DisplayName("Сумма заявки")] + public int Sum { get; set; } + [DisplayName("Время создания заявки")] + public DateTime RequestTime { get; set; } + [DisplayName("Статус заявки")] + public RequestStatus Status { get; set; } + } +} diff --git a/Bank/BankDataModels/Models/IClientModel.cs b/Bank/BankDataModels/Models/IClientModel.cs index 35cab4a..a97d51b 100644 --- a/Bank/BankDataModels/Models/IClientModel.cs +++ b/Bank/BankDataModels/Models/IClientModel.cs @@ -8,8 +8,8 @@ namespace BankDataModels.Models { public interface IClientModel : IId { - string Fio { get; } - string Email { get; } - string Password { get; } + string Fio { get; set; } + string Email { get; set; } + string Password { get; set; } } } diff --git a/Bank/BankDataModels/Models/IOperationModel.cs b/Bank/BankDataModels/Models/IOperationModel.cs index 2d0b393..d3870f8 100644 --- a/Bank/BankDataModels/Models/IOperationModel.cs +++ b/Bank/BankDataModels/Models/IOperationModel.cs @@ -6,11 +6,11 @@ using System.Threading.Tasks; namespace BankDataModels.Models { - public interface IOperationModel + public interface IOperationModel : IId { - int sum { get; set; } + int Sum { get; set; } DateTime OperationTime { get; set; } - int SenderCardId { get; set; } + int? SenderCardId { get; set; } int RecipientCardId { get; set; } } }