Ejemplo n.º 1
0
        public ActionResult CreateQuestion(QuestionAndChoiceVM Model)
        {
            Logger.Info("inside create -page started...");
            int questionType = Convert.ToInt32(Model.SelectedQuestionType);
            int examPaperId  = Convert.ToInt32(Model.SelectedExamPaper);

            string answer = Model.Options.GetType().GetProperties().Single(pi => pi.Name == Model.SelectedAnswer).GetValue(Model.Options, null).ToString();

            var result = _ExamBL.InsertQuestionWithAnswer(questionType, examPaperId, Model.QuestionText, Model.Options.Option1
                                                          , Model.Options.Option2, Model.Options.Option3, Model.Options.Option4, answer);


            return(View(Model));
        }
Ejemplo n.º 2
0
        public ActionResult CreateQuestion()
        {
            Logger.Info("inside create -page started...");
            QuestionAndChoiceVM Model         = new QuestionAndChoiceVM();
            List <QuestionType> QuestionTypes = _ExamBL.GetAllQuestionType();
            List <ExamPaper>    ExamPapers    = _ExamBL.GetAllExamPaper();

            QuestionTypes.ForEach((item) => Model.QuestionTypeList.Add(new SelectListItem()
            {
                Text  = item.TypeName,
                Value = item.ID.ToString()
            }));

            ExamPapers.ForEach((item) => Model.ExamPaperList.Add(new SelectListItem()
            {
                Text  = item.PaperName,
                Value = item.ID.ToString()
            }));

            return(View(Model));
        }