21 lines
No EOL
691 B
C#
21 lines
No EOL
691 B
C#
using SurveyBackend.DTOs.Completion;
|
|
using SurveyLib.Core.Models;
|
|
|
|
namespace SurveyBackend.Mappers;
|
|
|
|
public static class CompletionMapper
|
|
{
|
|
public static Completion CreateDtoToModel(CompletionCreateDto dto, int surveyId, int? performerId) => new Completion
|
|
{
|
|
SurveyId = surveyId,
|
|
CompletedBy = performerId,
|
|
Answers = dto.Answers.Select(AnswerMapper.CreateDtoToModel).ToList(),
|
|
};
|
|
|
|
public static CompletionOutputDto ModelToOutputDto(Completion model) => new CompletionOutputDto
|
|
{
|
|
CompletedBy = model.CompletedBy,
|
|
FinishedAt = model.FinishedAt,
|
|
Answers = model.Answers.Select(AnswerMapper.ModelToOutputDto).ToList(),
|
|
};
|
|
} |