From 4d4b783b2789aa989f7542f2483b9aca65bfb2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9?= Date: Sat, 1 Apr 2023 12:26:05 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=20ViewModel=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=20=D1=82=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=BA=D0=BE=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D1=8B=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HardwareShopContracts.csproj | 4 ++++ .../ViewModels/BuildViewModel.cs | 21 +++++++++++++++++ .../ViewModels/ClientViewModel.cs | 23 +++++++++++++++++++ .../ViewModels/CommentViewModel.cs | 15 ++++++++++++ .../ViewModels/ComponentViewModel.cs | 14 +++++++++++ .../ViewModels/GoodViewModel.cs | 15 ++++++++++++ .../ViewModels/OrderViewModel.cs | 11 +++++++++ .../ViewModels/PurchaseViewModel.cs | 23 +++++++++++++++++++ .../HardwareShopDataModels/Enums/UserRole.cs | 1 + .../Models/IBuildModel.cs | 2 +- .../Models/ICommentModel.cs | 2 +- .../Models/IComponentModel.cs | 2 +- .../Models/IGoodModel.cs | 2 +- 13 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/ClientViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/ComponentViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/GoodViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/OrderViewModel.cs create mode 100644 HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs diff --git a/HardwareShop/HardwareShopContracts/HardwareShopContracts.csproj b/HardwareShop/HardwareShopContracts/HardwareShopContracts.csproj index 132c02c..615c25a 100644 --- a/HardwareShop/HardwareShopContracts/HardwareShopContracts.csproj +++ b/HardwareShop/HardwareShopContracts/HardwareShopContracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs new file mode 100644 index 0000000..5538c89 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs @@ -0,0 +1,21 @@ +using FoodOrdersDataModels.Models; +using HardwareShopDataModels.Models; +using System.ComponentModel; +namespace FoodOrdersContracts.ViewModels +{ + public class BuildViewModel : IBuildModel + { + public int Id { get; set; } + + [DisplayName("Цена")] + public decimal Price { get; set; } + + [DisplayName("Название компонента")] + public string BuildName { get; set; } = string.Empty; + + [DisplayName("Email клиента")] + public string Email { get; set; } = string.Empty; + + public int UserID { get; set; } + } +} diff --git a/HardwareShop/HardwareShopContracts/ViewModels/ClientViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/ClientViewModel.cs new file mode 100644 index 0000000..cfc58f7 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/ClientViewModel.cs @@ -0,0 +1,23 @@ +using FoodOrdersDataModels.Models; +using HardwareShopDataModels.Enums; +using System.ComponentModel; + +namespace FoodOrdersContracts.ViewModels +{ + public class ClientViewModel : IClientModel + { + public int Id { get; set; } + + [DisplayName("Логин клиента")] + public string Login { get; set; } = string.Empty; + + [DisplayName("Email клиента")] + public string Email { get; set; } = string.Empty; + + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + + [DisplayName("Роль")] + public UserRole Role { get; set; } = UserRole.Неизвестен; + } +} \ No newline at end of file diff --git a/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs new file mode 100644 index 0000000..6e73a3c --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs @@ -0,0 +1,15 @@ +using FoodOrdersDataModels.Models; +using HardwareShopDataModels.Models; +using System.ComponentModel; + +namespace FoodOrdersContracts.ViewModels +{ + public class CommentViewModel : ICommentModel + { + public string Text => throw new NotImplementedException(); + + public int BuildID => throw new NotImplementedException(); + + public int Id => throw new NotImplementedException(); + } +} diff --git a/HardwareShop/HardwareShopContracts/ViewModels/ComponentViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..22d6e23 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,14 @@ +using HardwareShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FoodOrdersContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id => throw new NotImplementedException(); + } +} diff --git a/HardwareShop/HardwareShopContracts/ViewModels/GoodViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/GoodViewModel.cs new file mode 100644 index 0000000..191360e --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/GoodViewModel.cs @@ -0,0 +1,15 @@ +using FoodOrdersDataModels.Enums; +using HardwareShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FoodOrdersContracts.ViewModels +{ + public class GoodViewModel : IGoodModel + { + public int Id => throw new NotImplementedException(); + } +} diff --git a/HardwareShop/HardwareShopContracts/ViewModels/OrderViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..73ea37f --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,11 @@ +using FoodOrdersDataModels.Enums; +using FoodOrdersDataModels.Models; +using HardwareShopDataModels.Models; +using System.ComponentModel; +namespace FoodOrdersContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + public int Id => throw new NotImplementedException(); + } +} diff --git a/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs new file mode 100644 index 0000000..094d2b1 --- /dev/null +++ b/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs @@ -0,0 +1,23 @@ +using FoodOrdersDataModels.Enums; +using FoodOrdersDataModels.Models; +using HardwareShopDataModels.Models; +using System.ComponentModel; +namespace FoodOrdersContracts.ViewModels +{ + public class PurachaseViewModel : IPurchaseModel + { + public int Id => throw new NotImplementedException(); + + public decimal Sum => throw new NotImplementedException(); + + public PurchaseStatus Status => throw new NotImplementedException(); + + public DateTime? DatePurchase => throw new NotImplementedException(); + + public int UserID => throw new NotImplementedException(); + + public Dictionary? PurchaseBuilds => throw new NotImplementedException(); + + public Dictionary PurchaseGoods => throw new NotImplementedException(); + } +} diff --git a/HardwareShop/HardwareShopDataModels/Enums/UserRole.cs b/HardwareShop/HardwareShopDataModels/Enums/UserRole.cs index 63c95be..13807b1 100644 --- a/HardwareShop/HardwareShopDataModels/Enums/UserRole.cs +++ b/HardwareShop/HardwareShopDataModels/Enums/UserRole.cs @@ -8,6 +8,7 @@ namespace HardwareShopDataModels.Enums { public enum UserRole { + Неизвестен = 0, Работник = 1, Кладовщик = 2, } diff --git a/HardwareShop/HardwareShopDataModels/Models/IBuildModel.cs b/HardwareShop/HardwareShopDataModels/Models/IBuildModel.cs index 1726cae..d20ee56 100644 --- a/HardwareShop/HardwareShopDataModels/Models/IBuildModel.cs +++ b/HardwareShop/HardwareShopDataModels/Models/IBuildModel.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace HardwareShopDataModels.Models { - public interface IBuildModel + public interface IBuildModel : IId { decimal Price { get; } diff --git a/HardwareShop/HardwareShopDataModels/Models/ICommentModel.cs b/HardwareShop/HardwareShopDataModels/Models/ICommentModel.cs index b663af7..9f57aab 100644 --- a/HardwareShop/HardwareShopDataModels/Models/ICommentModel.cs +++ b/HardwareShop/HardwareShopDataModels/Models/ICommentModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace HardwareShopDataModels.Models { - public interface ICommentModel + public interface ICommentModel : IId { string Text { get; } diff --git a/HardwareShop/HardwareShopDataModels/Models/IComponentModel.cs b/HardwareShop/HardwareShopDataModels/Models/IComponentModel.cs index d498566..c5a820a 100644 --- a/HardwareShop/HardwareShopDataModels/Models/IComponentModel.cs +++ b/HardwareShop/HardwareShopDataModels/Models/IComponentModel.cs @@ -1,6 +1,6 @@ namespace HardwareShopDataModels.Models { - public interface IComponentModel + public interface IComponentModel : IId { } } diff --git a/HardwareShop/HardwareShopDataModels/Models/IGoodModel.cs b/HardwareShop/HardwareShopDataModels/Models/IGoodModel.cs index 9fb6b6c..fd830b4 100644 --- a/HardwareShop/HardwareShopDataModels/Models/IGoodModel.cs +++ b/HardwareShop/HardwareShopDataModels/Models/IGoodModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace HardwareShopDataModels.Models { - public interface IGoodModel + public interface IGoodModel : IId { } }