add all docs
This commit is contained in:
parent
d692a2e519
commit
edff901b52
4 changed files with 49 additions and 0 deletions
|
|
@ -5,8 +5,18 @@ using SurveyLib.Core.Models.QuestionVariants;
|
|||
|
||||
namespace SurveyBackend.Mappers;
|
||||
|
||||
/// <summary>
|
||||
/// Маппер всего про вопросы
|
||||
/// </summary>
|
||||
public static class QuestionMapper
|
||||
{
|
||||
/// <summary>
|
||||
/// Создание вопроса в модель
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="surveyId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BadRequestException"></exception>
|
||||
public static QuestionBase QuestionCreationToModel(CreateQuestionDto dto, int surveyId)
|
||||
{
|
||||
return dto.QuestionType.ToLower() switch
|
||||
|
|
@ -32,6 +42,11 @@ public static class QuestionMapper
|
|||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Модель в выходную схему
|
||||
/// </summary>
|
||||
/// <param name="question"></param>
|
||||
/// <returns></returns>
|
||||
public static OutputQuestionDto ModelToQuestionDto(QuestionBase question)
|
||||
{
|
||||
var withAnswerVariants = question.GetType() != typeof(TextQuestion);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue