From 9d25188cf51134bf54f06887b0b377b8614d9248 Mon Sep 17 00:00:00 2001 From: ujijrujijr Date: Fri, 19 Apr 2024 16:37:22 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=B9,=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D1=83=20=D0=B1?= =?UTF-8?q?=D0=B8=D0=B7=D0=BD=D0=B5=D1=81-=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComputerShopBusinessLogic.csproj | 8 ++++++ .../BindingModels/UserBindingModel.cs | 20 +++++++++++++++ .../BusinessLogicContracts/IUserLogic.cs | 20 +++++++++++++++ .../SearchModels/UserSearchModel.cs | 18 +++++++++++++ .../StorageContracts/IUserStorage.cs | 21 ++++++++++++++++ .../ViewModels/UserViewModel.cs | 25 +++++++++++++++++++ ComputerShopDataModels/Models/IUserModel.cs | 15 +++++++++++ 7 files changed, 127 insertions(+) create mode 100644 ComputerShopContracts/BindingModels/UserBindingModel.cs create mode 100644 ComputerShopContracts/BusinessLogicContracts/IUserLogic.cs create mode 100644 ComputerShopContracts/SearchModels/UserSearchModel.cs create mode 100644 ComputerShopContracts/StorageContracts/IUserStorage.cs create mode 100644 ComputerShopContracts/ViewModels/UserViewModel.cs create mode 100644 ComputerShopDataModels/Models/IUserModel.cs diff --git a/ComputerShopBusinessLogic/ComputerShopBusinessLogic.csproj b/ComputerShopBusinessLogic/ComputerShopBusinessLogic.csproj index 63a55ef..bb69535 100644 --- a/ComputerShopBusinessLogic/ComputerShopBusinessLogic.csproj +++ b/ComputerShopBusinessLogic/ComputerShopBusinessLogic.csproj @@ -6,8 +6,16 @@ enable + + + + + + + + diff --git a/ComputerShopContracts/BindingModels/UserBindingModel.cs b/ComputerShopContracts/BindingModels/UserBindingModel.cs new file mode 100644 index 0000000..6031abb --- /dev/null +++ b/ComputerShopContracts/BindingModels/UserBindingModel.cs @@ -0,0 +1,20 @@ +using ComputerShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputerShopContracts.BindingModels +{ + public class UserBindingModel : IUserModel + { + public int Id { get; set; } + //!!!МБ НЕ НАДО string.Empty + public string Login { get; set; } = string.Empty; + //!!!МБ НЕ НАДО string.Empty + public string Password { get; set; } = string.Empty; + //!!!МБ НЕ НАДО string.Empty + public string Email { get; set; } = string.Empty; + } +} diff --git a/ComputerShopContracts/BusinessLogicContracts/IUserLogic.cs b/ComputerShopContracts/BusinessLogicContracts/IUserLogic.cs new file mode 100644 index 0000000..0a6ce48 --- /dev/null +++ b/ComputerShopContracts/BusinessLogicContracts/IUserLogic.cs @@ -0,0 +1,20 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputerShopContracts.BusinessLogicContracts +{ + public interface IUserLogic + { + List? ReadList(UserSearchModel? model); + UserViewModel? ReadElement(UserSearchModel model); + bool Create(UserBindingModel model); + bool Update(UserBindingModel model); + bool Delete(UserBindingModel model); + } +} diff --git a/ComputerShopContracts/SearchModels/UserSearchModel.cs b/ComputerShopContracts/SearchModels/UserSearchModel.cs new file mode 100644 index 0000000..cb907f2 --- /dev/null +++ b/ComputerShopContracts/SearchModels/UserSearchModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputerShopContracts.SearchModels +{ + public class UserSearchModel + { + public int? Id { get; set; } + public string? Login { get; set; } + + //!!!ПОИСК ПО ПАРОЛЮ НЕ СТАЛ ДОБАВЛЯТЬ, ИБО СТРАННО + + public string? Email { get; set; } + } +} diff --git a/ComputerShopContracts/StorageContracts/IUserStorage.cs b/ComputerShopContracts/StorageContracts/IUserStorage.cs new file mode 100644 index 0000000..4874afc --- /dev/null +++ b/ComputerShopContracts/StorageContracts/IUserStorage.cs @@ -0,0 +1,21 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputerShopContracts.StorageContracts +{ + public interface IUserStorage + { + List GetFullList(); + List GetFilteredList(UserSearchModel model); + UserViewModel? GetElement(UserSearchModel model); + UserViewModel? Insert(UserBindingModel model); + UserViewModel? Update(UserBindingModel model); + UserViewModel? Delete(UserBindingModel model); + } +} diff --git a/ComputerShopContracts/ViewModels/UserViewModel.cs b/ComputerShopContracts/ViewModels/UserViewModel.cs new file mode 100644 index 0000000..c644d94 --- /dev/null +++ b/ComputerShopContracts/ViewModels/UserViewModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputerShopContracts.ViewModels +{ + public class UserViewModel + { + //!!!МБ ТУТ НАДО DisplayName (НО ВРЯД ЛИ) + public int Id { get; set; } + + //!!!МБ ТУТ НЕ НУЖНЫ string.Empty + [DisplayName("Логин")] + public string Login { get; set; } = string.Empty; + + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + + [DisplayName("Почта")] + public string Email { get; set; } = string.Empty; + } +} diff --git a/ComputerShopDataModels/Models/IUserModel.cs b/ComputerShopDataModels/Models/IUserModel.cs new file mode 100644 index 0000000..7279902 --- /dev/null +++ b/ComputerShopDataModels/Models/IUserModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputerShopDataModels.Models +{ + public interface IUserModel : IId + { + string Login { get; } + string Password { get; } + string Email { get; } + } +}