public void CreateQuiz(QuizDTO quizDto)
        {
            ValidatorBlogModels.ValidateQuizModel(quizDto);
            var mapper  = MapperConfig.GetConfigFromDTO().CreateMapper();
            var quizNew = mapper.Map <Quiz>(quizDto);

            DataBase.Quizes.Create(quizNew);
            DataBase.Save();
        }
        public void CreateComment(CommentDTO commentDto)
        {
            ValidatorBlogModels.ValidateCommentModel(commentDto);
            var article    = DataBase.Articles.Get(commentDto.IdArticle);
            var mapper     = MapperConfig.GetConfigFromDTO().CreateMapper();
            var commentNew = mapper.Map <Comment>(commentDto);

            DataBase.Comments.Create(commentNew);
            DataBase.Save();
        }
        public void UpdateAnswer(AnswerDTO answer)
        {
            if (DataBase.Answers.Get(answer.Id) == null)
            {
                throw new ValidationException("Answer wasn't found", "");
            }

            var mapper     = MapperConfig.GetConfigFromDTO().CreateMapper();
            var answerTemp = mapper.Map <Answer>(answer);

            DataBase.Answers.Update(answerTemp);
        }
        public IEnumerable <QuizDTO> GetQuizs()
        {
            var mapper = MapperConfig.GetConfigFromDTO().CreateMapper();

            return(mapper.Map <IEnumerable <QuizDTO> >(DataBase.Quizes.GetAll()));
        }