Click here to Skip to main content
15,885,141 members
Articles / Web Development / ASP.NET

YouGrade - Asp.NET MVC Multimedia Exam Suite

Rate me:
Please Sign up or sign in to vote.
4.93/5 (99 votes)
8 Jun 2011CPOL15 min read 232.3K   6.3K   192  
A multimedia exam suite built on Asp.NET and Youtube
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Instructor / Trainer Alura Cursos Online
Brazil Brazil

Comments and Discussions