From 4a958769f0d2aea0c24202396bd37a1c589f02e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=93=D0=BE=D1=80=D0=B4?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2?= <89176335310x@gmail.com> Date: Mon, 29 Apr 2024 19:34:14 +0400 Subject: [PATCH] Mb not done --- .../BindingModels/OrderBindingModel.cs | 1 + .../SearchModels/OrderSearchModel.cs | 1 + .../ElectronicsShopContracts/ViewModels/OrderViewModel.cs | 2 ++ .../ElectronicsShopDataBaseImplement/DataBase.cs | 2 +- .../ElectronicsShopDataBaseImplement/Models/Order.cs | 7 ++++++- .../ElectronicsShopDataModels/Models/IOrderModel.cs | 1 + .../ElectronicsShopDataModels/Models/IUserModel.cs | 1 - 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ElectronicsShop/ElectronicsShopContracts/BindingModels/OrderBindingModel.cs b/ElectronicsShop/ElectronicsShopContracts/BindingModels/OrderBindingModel.cs index 59b88f6..93f602f 100644 --- a/ElectronicsShop/ElectronicsShopContracts/BindingModels/OrderBindingModel.cs +++ b/ElectronicsShop/ElectronicsShopContracts/BindingModels/OrderBindingModel.cs @@ -11,6 +11,7 @@ namespace ElectronicsShopContracts.BindingModels public class OrderBindingModel : IOrderModel { public int ID { get; set; } + public int UserID { get; set; } public double Sum { get; set; } diff --git a/ElectronicsShop/ElectronicsShopContracts/SearchModels/OrderSearchModel.cs b/ElectronicsShop/ElectronicsShopContracts/SearchModels/OrderSearchModel.cs index 72c8848..3fb2f40 100644 --- a/ElectronicsShop/ElectronicsShopContracts/SearchModels/OrderSearchModel.cs +++ b/ElectronicsShop/ElectronicsShopContracts/SearchModels/OrderSearchModel.cs @@ -10,6 +10,7 @@ namespace ElectronicsShopContracts.SearchModels public class OrderSearchModel { public int? ID { get; set; } + public int? UserID { get; set; } public DateTime? DateFrom { get; set; } public DateTime? DateTo { get; set;} } diff --git a/ElectronicsShop/ElectronicsShopContracts/ViewModels/OrderViewModel.cs b/ElectronicsShop/ElectronicsShopContracts/ViewModels/OrderViewModel.cs index 10c59a2..3bd8874 100644 --- a/ElectronicsShop/ElectronicsShopContracts/ViewModels/OrderViewModel.cs +++ b/ElectronicsShop/ElectronicsShopContracts/ViewModels/OrderViewModel.cs @@ -12,6 +12,8 @@ namespace ElectronicsShopContracts.ViewModels public class OrderViewModel : IOrderModel { public int ID { get; set; } + [DisplayName("Клиент ID")] + public int UserID { get; set; } [DisplayName("Сумма")] public double Sum { get; set; } diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs index 9bbb6b3..0279743 100644 --- a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs +++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs @@ -11,7 +11,7 @@ namespace ElectronicsShopDataBaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=ZooDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs index f0e7733..7d51d78 100644 --- a/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs +++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs @@ -19,6 +19,8 @@ namespace ElectronicsShopDataBaseImplement.Models [Required] public double Sum { get; set; } [Required] + public int UserID { get; set; } + [Required] public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; [Required] public PaymeantOption PaymeantOption { get; set; } = PaymeantOption.Неизвестно; @@ -51,6 +53,7 @@ namespace ElectronicsShopDataBaseImplement.Models return new Order() { ID = model.ID, + UserID=model.UserID, Sum = model.Sum, Status = model.Status, PaymeantOption = model.PaymeantOption, @@ -69,6 +72,7 @@ namespace ElectronicsShopDataBaseImplement.Models return; } ID = model.ID; + UserID = model.UserID; Sum = model.Sum; PaymeantOption = model.PaymeantOption; Status = model.Status; @@ -83,11 +87,12 @@ namespace ElectronicsShopDataBaseImplement.Models public OrderViewModel GetViewModel => new() { ID = ID, + UserID = UserID, Sum = Sum, PaymeantOption = PaymeantOption, Status = Status, DateCreate = DateCreate, - DateImplement=DateImplement, + DateImplement = DateImplement, ProductList = ProductList }; } diff --git a/ElectronicsShop/ElectronicsShopDataModels/Models/IOrderModel.cs b/ElectronicsShop/ElectronicsShopDataModels/Models/IOrderModel.cs index b569027..3269c88 100644 --- a/ElectronicsShop/ElectronicsShopDataModels/Models/IOrderModel.cs +++ b/ElectronicsShop/ElectronicsShopDataModels/Models/IOrderModel.cs @@ -10,6 +10,7 @@ namespace ElectronicsShopDataModels.Models public interface IOrderModel : IID { double Sum { get; } + int UserID { get; } OrderStatus Status { get; } PaymeantOption PaymeantOption { get; } DateTime DateCreate { get; } diff --git a/ElectronicsShop/ElectronicsShopDataModels/Models/IUserModel.cs b/ElectronicsShop/ElectronicsShopDataModels/Models/IUserModel.cs index ae58001..3c69672 100644 --- a/ElectronicsShop/ElectronicsShopDataModels/Models/IUserModel.cs +++ b/ElectronicsShop/ElectronicsShopDataModels/Models/IUserModel.cs @@ -11,7 +11,6 @@ namespace ElectronicsShopDataModels //ID role int RoleID { get; } - string FirstName { get; } string LastName { get; } string Password { get; }