Esempio n. 1
0
        public void Add(QuestionsDataModel questionsDataModel)
        {
            Questions Question = new Questions
            {
                Id                = questionsDataModel.Id,
                QuestionText      = questionsDataModel.QuestionText,
                DifficultyLevelId = questionsDataModel.DifficultyLevelId,
            };

            ContextGateway <Questions> .CreateDatabaseTransaction();

            ContextGateway <Questions> .Add(Question);

            foreach (QuestionAnswersDataModel questionAnswers in questionsDataModel.QuestionAnswersDataModel)
            {
                ContextGateway <Questions> .Add(
                    new QuestionAnswers
                {
                    Id         = questionAnswers.Id,
                    AnswerText = questionAnswers.AnswerText,
                    IsCorrect  = questionAnswers.IsCorrext,
                    QuestionId = Question.Id
                });
            }
            ContextGateway <Questions> .Commit();
        }
Esempio n. 2
0
        public void Add(DifficultyLevelsDataModel difficultyLevels)
        {
            DifficultyLevels difficultyLevelsInstance = new DifficultyLevels();

            difficultyLevelsInstance.DifficultyLevelName = difficultyLevels.DifficultyLevelName;


            ContextGateway <DifficultyLevels> .Add(difficultyLevelsInstance);
        }