diff --git a/JewelryStoreContracts/BindingModels/OrderBindingModel.cs b/JewelryStoreContracts/BindingModels/OrderBindingModel.cs index 77ed89e..9ec08a4 100644 --- a/JewelryStoreContracts/BindingModels/OrderBindingModel.cs +++ b/JewelryStoreContracts/BindingModels/OrderBindingModel.cs @@ -20,6 +20,7 @@ namespace JewelryStoreContracts.BindingModels public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime? DateImplement { get; set; } + public int? ImplementerId { get; set; } } } diff --git a/JewelryStoreContracts/ViewModels/OrderViewModel.cs b/JewelryStoreContracts/ViewModels/OrderViewModel.cs index 2d03e3c..0335141 100644 --- a/JewelryStoreContracts/ViewModels/OrderViewModel.cs +++ b/JewelryStoreContracts/ViewModels/OrderViewModel.cs @@ -33,6 +33,9 @@ namespace JewelryStoreContracts.ViewModels public DateTime DateCreate { get; set; } = DateTime.Now; [DisplayName("Дата выполнения")] public DateTime? DateImplement { get; set; } - } + public int? ImplementerId { get; set; } + [DisplayName("ФИО исполнителя")] + public string ImplementerFIO { get; set; } = string.Empty; + } } diff --git a/JewelryStoreDatabaseImplement/Models/Order.cs b/JewelryStoreDatabaseImplement/Models/Order.cs index 0e297d5..3bfbd59 100644 --- a/JewelryStoreDatabaseImplement/Models/Order.cs +++ b/JewelryStoreDatabaseImplement/Models/Order.cs @@ -20,6 +20,7 @@ namespace JewelryStoreDatabaseImplement.Models [Required] public int ClientId { get; set; } + public int? ImplementerId { get; private set; } public string JewelName { get; private set; } = string.Empty; @@ -39,6 +40,7 @@ namespace JewelryStoreDatabaseImplement.Models public virtual Jewel Jewel { get; set; } public virtual Client Client { get; set; } + public Implementer? Implementer { get; set; } public static Order? Create(OrderBindingModel? model) { @@ -52,6 +54,7 @@ namespace JewelryStoreDatabaseImplement.Models Id = model.Id, JewelId = model.JewelId, ClientId = model.ClientId, + ImplementerId = model.ImplementerId, JewelName = model.JewelName, Count = model.Count, Sum = model.Sum, @@ -87,13 +90,15 @@ namespace JewelryStoreDatabaseImplement.Models Id = Id, JewelId = JewelId, ClientId = ClientId, + ImplementerId = ImplementerId, ClientFIO = context.Clients.FirstOrDefault(x => x.Id == ClientId)?.ClientFIO ?? string.Empty, JewelName = context.Jewels.FirstOrDefault(x => x.Id == JewelId)?.JewelName ?? string.Empty, Count = Count, Sum = Sum, Status = Status, DateCreate = DateCreate, - DateImplement = DateImplement + DateImplement = DateImplement, + ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty }; } }