|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YouGrade.Model;
using AutoMapper;
using YouGrade.Dtos;
namespace YouGrade.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View(ExamManager.Instance.GetExam());
}
//public ActionResult About()
//{
// return View();
//}
[HttpGet]
public ActionResult GetQuestion()
{
var question = ExamManager.Instance.GetQuestion();
return Json(question, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public ActionResult SaveAnswer(int questionId, string answers)
{
var question = ExamManager.Instance.GetQuestion();
ExamManager.Instance.SaveAnswer(questionId, answers);
return Json(questionId, JsonRequestBehavior.AllowGet);
}
[HttpGet]
public ActionResult MoveToPreviousQuestion()
{
ExamManager.Instance.MoveToPreviousQuestion();
return GetQuestion();
}
[HttpGet]
public ActionResult MoveToNextQuestion()
{
ExamManager.Instance.MoveToNextQuestion();
return GetQuestion();
}
[HttpGet]
public ActionResult EndExam()
{
var result = ExamManager.Instance.EndExam();
return Json(
new {
success = true,
result = result
},
JsonRequestBehavior.AllowGet);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.