From 2a6e1b67f35adec8e9ecca5d8791f24c4ba793e2 Mon Sep 17 00:00:00 2001 From: frog24 Date: Sat, 27 Apr 2024 17:38:22 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D1=8B=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{IMedPurchase.cs => IDrugPurchase.cs} | 2 +- .../BindingModels/ClientBindingModel.cs | 17 +++++++++++++++ .../BusinessLogicsContracts/IClientLogic.cs | 19 +++++++++++++++++ .../SearchModels/ClientSearchModel.cs | 17 +++++++++++++++ .../StoragesContracts/IClientStorage.cs | 21 +++++++++++++++++++ .../VetclinicContracts.csproj | 4 ++++ .../ViewModels/ClientViewModel.cs | 21 +++++++++++++++++++ 7 files changed, 100 insertions(+), 1 deletion(-) rename Vetclinic/Vetclinic/Models/{IMedPurchase.cs => IDrugPurchase.cs} (86%) create mode 100644 Vetclinic/VetclinicContracts/BindingModels/ClientBindingModel.cs create mode 100644 Vetclinic/VetclinicContracts/BusinessLogicsContracts/IClientLogic.cs create mode 100644 Vetclinic/VetclinicContracts/SearchModels/ClientSearchModel.cs create mode 100644 Vetclinic/VetclinicContracts/StoragesContracts/IClientStorage.cs create mode 100644 Vetclinic/VetclinicContracts/ViewModels/ClientViewModel.cs diff --git a/Vetclinic/Vetclinic/Models/IMedPurchase.cs b/Vetclinic/Vetclinic/Models/IDrugPurchase.cs similarity index 86% rename from Vetclinic/Vetclinic/Models/IMedPurchase.cs rename to Vetclinic/Vetclinic/Models/IDrugPurchase.cs index aa7c722..420a32d 100644 --- a/Vetclinic/Vetclinic/Models/IMedPurchase.cs +++ b/Vetclinic/Vetclinic/Models/IDrugPurchase.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace VetclinicDataModels.Models { - public interface IMedPurchase: IId + public interface IDrugPurchase: IId { int ClientId { get; } double Cost { get; } diff --git a/Vetclinic/VetclinicContracts/BindingModels/ClientBindingModel.cs b/Vetclinic/VetclinicContracts/BindingModels/ClientBindingModel.cs new file mode 100644 index 0000000..d47d181 --- /dev/null +++ b/Vetclinic/VetclinicContracts/BindingModels/ClientBindingModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetclinicDataModels.Models; + +namespace VetclinicContracts.BindingModels +{ + public class ClientBindingModel: IClientModel + { + public int Id { get; set; } + public string ClientName { get; set; } = string.Empty; + public string Email { get; set; } = string.Empty; + public string Password { get; set; } = string.Empty; + } +} diff --git a/Vetclinic/VetclinicContracts/BusinessLogicsContracts/IClientLogic.cs b/Vetclinic/VetclinicContracts/BusinessLogicsContracts/IClientLogic.cs new file mode 100644 index 0000000..b6a284c --- /dev/null +++ b/Vetclinic/VetclinicContracts/BusinessLogicsContracts/IClientLogic.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetclinicContracts.BindingModels; +using VetclinicContracts.SearchModels; + +namespace VetclinicContracts.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/Vetclinic/VetclinicContracts/SearchModels/ClientSearchModel.cs b/Vetclinic/VetclinicContracts/SearchModels/ClientSearchModel.cs new file mode 100644 index 0000000..c2665ee --- /dev/null +++ b/Vetclinic/VetclinicContracts/SearchModels/ClientSearchModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetclinicDataModels.Models; + +namespace VetclinicContracts.SearchModels +{ + public class ClientSearchModel + { + public int? Id { get; set; } + public string? ClientName { get; set; } + public string? Email { get; set; } + public string? Password { get; set; } + } +} diff --git a/Vetclinic/VetclinicContracts/StoragesContracts/IClientStorage.cs b/Vetclinic/VetclinicContracts/StoragesContracts/IClientStorage.cs new file mode 100644 index 0000000..bb007eb --- /dev/null +++ b/Vetclinic/VetclinicContracts/StoragesContracts/IClientStorage.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetclinicContracts.BindingModels; +using VetclinicContracts.SearchModels; +using VetclinicContracts.ViewModels; + +namespace VetclinicContracts.StoragesContracts +{ + public interface IClientStorage + { + List GetFullList(); + List GetFiltredList(ClientSearchModel model); + ClientViewModel? GetElement(ClientSearchModel model); + ClientViewModel? Insert(ClientBindingModel model); + ClientViewModel? Update(ClientBindingModel model); + ClientViewModel? Delete(ClientBindingModel model); + } +} diff --git a/Vetclinic/VetclinicContracts/VetclinicContracts.csproj b/Vetclinic/VetclinicContracts/VetclinicContracts.csproj index 27ac386..4a4f55a 100644 --- a/Vetclinic/VetclinicContracts/VetclinicContracts.csproj +++ b/Vetclinic/VetclinicContracts/VetclinicContracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/Vetclinic/VetclinicContracts/ViewModels/ClientViewModel.cs b/Vetclinic/VetclinicContracts/ViewModels/ClientViewModel.cs new file mode 100644 index 0000000..c04e595 --- /dev/null +++ b/Vetclinic/VetclinicContracts/ViewModels/ClientViewModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetclinicDataModels.Models; + +namespace VetclinicContracts.ViewModels +{ + public class ClientViewModel: IClientModel + { + public int Id { get; set; } + [DisplayName("ФИО клиента")] + public string ClientName { get; set; } = string.Empty; + [DisplayName("Логин (эл. почта)")] + public string Email { get; set; } = string.Empty; + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + } +}