From 4af879f6207ff78b95909bcfd6dd448bb979d21a Mon Sep 17 00:00:00 2001 From: Allllen4a Date: Tue, 30 Apr 2024 15:02:53 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/EvaluationLogic.cs | 5 +---- .../BindingModels/ServiceBindingModel.cs | 5 +++-- .../BusinessLogicContracts/IEvaluationLogic.cs | 1 - .../BeautySalonDatabaseImplement/Models/Service.cs | 11 ++++++----- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/BeautySalonView/BeautySalonBusinessLogic/BusinessLogic/EvaluationLogic.cs b/BeautySalonView/BeautySalonBusinessLogic/BusinessLogic/EvaluationLogic.cs index 8fd92f8..9cb7a5a 100644 --- a/BeautySalonView/BeautySalonBusinessLogic/BusinessLogic/EvaluationLogic.cs +++ b/BeautySalonView/BeautySalonBusinessLogic/BusinessLogic/EvaluationLogic.cs @@ -21,10 +21,7 @@ namespace BeautySalonBusinessLogic.BusinessLogics _logger = logger; _evaluationStorage = evaluationStorage; } - public int GetNumberOfPages(int userId, int pageSize = 10) - { - return _evaluationStorage.GetNumberOfPages(userId, pageSize); - } + public List? ReadList(EvaluationSearchModel? model) { _logger.LogInformation("ReadList. Id: {Id}", diff --git a/BeautySalonView/BeautySalonContracts/BindingModels/ServiceBindingModel.cs b/BeautySalonView/BeautySalonContracts/BindingModels/ServiceBindingModel.cs index 519640e..32e3694 100644 --- a/BeautySalonView/BeautySalonContracts/BindingModels/ServiceBindingModel.cs +++ b/BeautySalonView/BeautySalonContracts/BindingModels/ServiceBindingModel.cs @@ -1,4 +1,5 @@ -using BeautySalonDataModels.Models; +using BeautySalonContracts.ViewModels; +using BeautySalonDataModels.Models; using System; using System.Collections.Generic; using System.Linq; @@ -13,6 +14,6 @@ namespace BeautySalonContracts.BindingModels public string ServiceName { get; set; } = string.Empty; public double ServicePrice { get; set; } public int StaffMemberId { get; set; } - public Dictionary ServiceCosmetics { get; set; } = new(); + public List ServiceCosmetics { get; set; } = new(); } } diff --git a/BeautySalonView/BeautySalonContracts/BusinessLogicContracts/IEvaluationLogic.cs b/BeautySalonView/BeautySalonContracts/BusinessLogicContracts/IEvaluationLogic.cs index 54949d2..14fd59e 100644 --- a/BeautySalonView/BeautySalonContracts/BusinessLogicContracts/IEvaluationLogic.cs +++ b/BeautySalonView/BeautySalonContracts/BusinessLogicContracts/IEvaluationLogic.cs @@ -12,6 +12,5 @@ namespace BeautySalonContracts.BusinessLogicContracts bool Create(EvaluationBindingModel model); bool Update(EvaluationBindingModel model); bool Delete(EvaluationBindingModel model); - int GetNumberOfPages(int userId, int pageSize = 10); } } diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Models/Service.cs b/BeautySalonView/BeautySalonDatabaseImplement/Models/Service.cs index 3832078..13c9f1a 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Models/Service.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Models/Service.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; + using System.Diagnostics; using System.Linq; using System.Text; @@ -48,8 +49,8 @@ namespace BeautySalonDatabaseImplement.Models public virtual List Cosmetics { get; set; } = new(); // связь услуги и заказов многие - ко - многим - // [ForeignKey("ServiceId")] - //public virtual List Orders { get; set; } = new(); + [ForeignKey("ServiceId")] + public virtual List Orders { get; set; } = new(); public static Service Create(BeautySalonDatabase context, ServiceBindingModel model) { @@ -58,13 +59,13 @@ namespace BeautySalonDatabaseImplement.Models Id = model.Id, ServiceName = model.ServiceName, ServicePrice = model.ServicePrice, - Cosmetics = model.ServiceCosmetics.Select(x => new CosmeticProcedure() + Cosmetics = model.ServiceCosmetics.Select(x => new ServiceCosmetic() { Cosmetic = context.Cosmetics.First(y => y.Id == x.Cosmetic.Id), - ProcedureCosmeticCount = x.Count + ServiceCosmeticCount = x.Count }).ToList(), StaffMemberId = model.StaffMemberId - }; + }; } public void Update(ServiceBindingModel model)