Пример #1
0
        public ActionResult ViewTestResults()
        {
            //Marking happens here
            //Update model to reflect mark
            List <StudentTestQuestionAnswerModel> testQuestions = StudentTestQuestionAnswerModel.instance;

            testQuestions.ForEach(curAnswer => {
                int pos = testQuestions.IndexOf(curAnswer);
                testQuestions[pos].MarkObtained =
                    SimpleSQLCheck.SQL_NPAWL.CalculateMarkForQuestion(
                        testQuestions[pos].QuestionAnswer,
                        _questionStore.GetQuestion(testQuestions[pos].QuestionID).QuestionAnswer,
                        testQuestions[pos].QuestionMark
                        );
            });
            SaveToDatabase(testQuestions);
            var answers = StudentTestQuestionAnswerModel.instance;

            if (answers == null)
            {
                String UserID = User.Identity.Name;
                return(View(StudentTestQuestionAnswerModel.instance));
            }
            else
            {
                return(View(StudentTestQuestionAnswerModel.instance));
            }
        }
        public IActionResult Delete(int?Id)
        {
            var question = _Question.GetQuestion(Id);

            if (question == null)
            {
                return(RedirectToAction("Index"));
            }
            dynamic models = new ExpandoObject();

            models.Question = question;
            models.Options  = _Option.GetOptionsByQuestionId(Id);
            return(View(models));
        }
Пример #3
0
        public questions GetQuestion(string questionName, string surveyCode)
        {
            int surveyId   = surveyDAL.GetSurveyIdBySurveyCode(surveyCode);
            int questionId = questionDAL.GetQuestionId(surveyId, questionName);

            return(questionDAL.GetQuestion(questionId));
        }
Пример #4
0
 public IHttpActionResult GET(int id = -1)
 {
     if (id == -1)
     {
         return(Ok(_adapter.GetAllQuestions()));
     }
     else
     {
         return(Ok(_adapter.GetQuestion(id)));
     }
 }
Пример #5
0
 public static IList <QuestionInfo> GetQuestion(int startRowIndex, int maximumRows, int searchType, string keyword)
 {
     switch (searchType)
     {
     case 7:
     case 8:
     case 9:
         if (string.IsNullOrEmpty(keyword))
         {
             searchType = 0;
         }
         break;
     }
     return(dal.GetQuestion(startRowIndex, maximumRows, searchType, DataSecurity.FilterBadChar(keyword)));
 }
Пример #6
0
        private void RenderNextQuestion()
        {
            if (!Quiz.GoToNextQuestion())
            {
                EndQuiz();
                return;
            }

            CurrentQuestion = Quiz.GetCurrentQuestion();

            lQuestion.Content = CurrentQuestion.GetQuestion();

            tAnswer.Text = "";
            tAnswer.Focus();

            lAnswer.Content   = "";
            lMessage.Content  = "";
            bSubmit.IsEnabled = true;
            bNext.IsEnabled   = false;
        }
Пример #7
0
 public IActionResult Index()
 {
     return(View(_Question.GetQuestion()));
 }