示例#1
0
        public static QuestionDTO Map(CreateQuestionViewModel viewmodel)
        {
            QuestionDTO dto = new QuestionDTO
            {
                Question = viewmodel.Question
            };

            foreach (var answer in viewmodel.Answers)
            {
                dto.Answers.Add(DTOMapper.Map(answer));
            }
            return(dto);
        }
示例#2
0
        public QuizDTO Map(CreateQuizViewModel viewmodel, ApplicationUserDTO user)
        {
            QuizDTO dto = new QuizDTO(quizEntityMapper.AddNewQuiz)
            {
                Id                = viewmodel.Id,
                Description       = viewmodel.Description,
                Title             = viewmodel.Title,
                ApplicationUserId = user.Id,
                ApplicationUser   = user,
                FilePath          = viewmodel.Path,
                QuizType          = viewmodel.QuizType,
                QuizAccessLevel   = viewmodel.QuizAccessLevel,
                //CreationDate = DateTime.Today.ToString(QuizDTO.CreationDateFormat),
                CreationDate = DateTime.Today
            };

            foreach (var question in viewmodel.Questions)
            {
                dto.Questions.Add(DTOMapper.Map(question));
            }
            return(dto);
        }