Правки по faq-контроллеру

This commit is contained in:
Olga Nemt 2023-04-27 12:29:17 +05:00
parent 97476265c2
commit 51a4214062
2 changed files with 18 additions and 0 deletions

View File

@ -52,5 +52,15 @@ namespace AsbCloudApp.Data
/// Частый вопрос
/// </summary>
public bool IsFrequently { get; set; } = false;
/// <summary>
/// Автор вопроса
/// </summary>
public string AurhorQuestionName { get; set; } = string.Empty;
/// <summary>
/// Автор ответа
/// </summary>
public string? AurhorAnswerName { get; set; }
}
}

View File

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