added questions output (SHIT CODE)

This commit is contained in:
Вячеслав 2025-04-20 20:07:04 +05:00
parent 7d76a9f67c
commit ddfb5eff54
11 changed files with 93 additions and 9 deletions

View file

@ -7,22 +7,22 @@ namespace SurveyBackend.Mappers.QuestionDTOs;
public static class QuestionCreationMapper
{
public static QuestionBase QuestionCreationToModel(CreateQuestionDTO dto)
public static QuestionBase QuestionCreationToModel(CreateQuestionDto dto)
{
return dto.QuestionType.ToLower() switch
{
"text" => new TextQuestion
"textquestion" => new TextQuestion
{
Title = dto.Title,
SurveyId = dto.SurveyId,
},
"single" => new SingleAnswerQuestion
"singleanswerquestion" => new SingleAnswerQuestion
{
Title = dto.Title,
SurveyId = dto.SurveyId,
AnswerVariants = dto.AnswerVariants?.Select(v => new AnswerVariant { Text = v }).ToList() ?? [],
},
"multiple" => new MultipleAnswerQuestion
"multipleanswerquestion" => new MultipleAnswerQuestion
{
Title = dto.Title,
SurveyId = dto.SurveyId,