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);