From 51a4214062d7f5755367700711737ab6fe63b6dc Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 27 Apr 2023 12:29:17 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20faq-=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB?= =?UTF-8?q?=D0=B5=D1=80=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/FaqDto.cs | 10 ++++++++++ AsbCloudInfrastructure/Repository/FaqRepository.cs | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/AsbCloudApp/Data/FaqDto.cs b/AsbCloudApp/Data/FaqDto.cs index 13f17c29..3f817fdf 100644 --- a/AsbCloudApp/Data/FaqDto.cs +++ b/AsbCloudApp/Data/FaqDto.cs @@ -52,5 +52,15 @@ namespace AsbCloudApp.Data /// Частый вопрос /// public bool IsFrequently { get; set; } = false; + + /// + /// Автор вопроса + /// + public string AurhorQuestionName { get; set; } = string.Empty; + + /// + /// Автор ответа + /// + public string? AurhorAnswerName { get; set; } } } diff --git a/AsbCloudInfrastructure/Repository/FaqRepository.cs b/AsbCloudInfrastructure/Repository/FaqRepository.cs index 50e0f383..d266494c 100644 --- a/AsbCloudInfrastructure/Repository/FaqRepository.cs +++ b/AsbCloudInfrastructure/Repository/FaqRepository.cs @@ -57,6 +57,11 @@ namespace AsbCloudInfrastructure.Repository IsFrequently = o.IsFrequently, State = o.State, DateCreatedQuestion = o.DateCreatedQuestion, + IdAuthorQuestion = o.IdAuthorQuestion, + AurhorQuestionName = o.AuthorQuestion.MakeDisplayName(), + AurhorAnswerName = (o.AuthorAnswer != null) + ? o.AuthorAnswer.MakeDisplayName() + : string.Empty, }); @@ -74,6 +79,9 @@ namespace AsbCloudInfrastructure.Repository entity.DateCreatedQuestion = entity.DateLastEditedQuestion = DateTimeOffset.UtcNow; entity.CounterQuestion = 1; entity.State = Faq.StateOpened; + if (!string.IsNullOrEmpty(entity.Answer)) + entity.IdAuthorAnswer = entity.IdAuthorQuestion; + db.Faqs.Add(entity);