added questions output (SHIT CODE)
This commit is contained in:
parent
7d76a9f67c
commit
ddfb5eff54
11 changed files with 93 additions and 9 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue