public ActionResult MoveToPrevQuestion() { var q = Questions.GetAndSetPrevQuestion(); var qa = new QuestionAjax(); if (q is StartQuestion) { qa.url = Url.Action("Start", "Start"); qa.name = "Start"; } else { Convert(q, qa); } return Json(qa, JsonRequestBehavior.AllowGet); }
public ActionResult MoveToNextQuestion() { var q = Questions.GetAndSetNextQuestion(); var qa = new QuestionAjax(); if (q is EndQuestion) { qa.url = Url.Action("End", "End"); qa.name = "Einde"; } else { Convert(q, qa); } return Json(qa, JsonRequestBehavior.AllowGet); }
private void Convert(Models.Question q, QuestionAjax qa) { qa.url = Url.Action(q.GetType().Name, "Question", new { guid = q.Guid }); qa.name = q.Description; qa.question = q.Title; qa.answer = q.Answer; if (q is MultipleChoiceQuestion) { qa.answers = getMultipleChoiceAnswers(((MultipleChoiceQuestion)q).Answers); } else if (q is OddOneOutQuestion) { qa.answers = getMultipleChoiceAnswers(((OddOneOutQuestion)q).Answers); qa.answer += " " + ((OddOneOutQuestion)q).Explanation; } else { qa.answers = "<span class=\"subtle\">open vraag</span>"; } }