Пример #1
0
        public IActionResult Store(Question question)
        {
            var questionId = "_" + DateTime.Now.ToString("yyyyMMddHHmmss");

            _newVersionHintsDbContext.QuestionMode.Add(new QuestionMode
            {
                CQid               = questionId,
                CPaperId           = null,
                CDivisionId        = null,
                CQuestionGroupId   = null,
                CQuestionGroupName = null,
                CQuestionMode      = "General",
                CQuestionType      = question.QuestionType
            });

            _newVersionHintsDbContext.QuestionIndex.Add(new QuestionIndex
            {
                CQid      = questionId,
                CQuestion = question.QuestionTitle,
                SLevel    = 1,
                CAnswer   = question.FillOutAnswer
            });

            if (question.QuestionType == "1")
            {
                foreach (var choice in question.SelectionChoices)
                {
                    var index = question.SelectionChoices.IndexOf(choice);

                    _newVersionHintsDbContext.QuestionSelectionIndex.Add(new QuestionSelectionIndex
                    {
                        CQid         = questionId,
                        CSelectionId = "_Selection_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + index,
                        SSeq         = (short)index,
                        CSelection   = choice.Answer,
                        CResponse    = null,
                        BCaseSelect  = choice.Correct
                    });
                }
            }

            _newVersionHintsDbContext.IvrsselectionQuestion.Add(new IvrsselectionQuestion
            {
                CQid     = questionId,
                CNodeId  = question.NodeId,
                Selected = 0
            });

            _newVersionHintsDbContext.SaveChanges();

            return(Ok(questionId));
        }
Пример #2
0
        public IActionResult Store(Ivrsprofession profession)
        {
            var professionNodeId = profession.Name + '_' + DateTime.Now.ToString("yyyyMMddHHmmss");

            _newVersionHintsDbContext.Ivrsprofession.Add(new Ivrsprofession
            {
                CCourseId = profession.CCourseId,
                NodeId    = professionNodeId,
                Name      = profession.Name
            });

            _newVersionHintsDbContext.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }