コード例 #1
0
 public ActionResult PlayQuiz()
 {
     Assignment assignment = DocumentorDB.Assignments.Where(a => a.id == Int32.Parse(Request.Params["assignment_id"])).First();
     Quiz quiz = DocumentorDB.Quizs.Where(a => a.id == assignment.CaseStudy.CaseStudyQuizs.First().quiz_id).First();
     var quiz_questions = new Dictionary<int, QuestionAnswers>();
     List<Response> responses = new List<Response>();
     foreach (Question q in quiz.QuizQuestions.Select(a => a.Question).ToList())
     {
         quiz_questions.Add(q.id, new QuestionAnswers(q.id, q.question_content, q.question_type_id == 1 || q.question_type_id == 2 ? true : false, q.AnswerChoices.ToList()));
         Response r = new Response();
         r.assignment_id = assignment.id;
         r.question_id = q.id;
         responses.Add(r);
     }
     ViewData["assignment"] = assignment;
     ViewData["quiz"] = quiz;
     //ViewData["quiz_questions"] = quiz.QuizQuestions.Select(a => a.Question).ToList();
     ViewData["quiz_questions"] = quiz_questions;
     ViewData["responses"] = responses;
     ViewData["time_alloted"] = 30;
     return View();
 }
コード例 #2
0
 public ActionResult SaveQuizData()
 {
     Quiz quiz = DocumentorDB.Quizs.Where(a => a.id == Int32.Parse(Request.Params["quiz_id"])).First();
     Assignment assignment = DocumentorDB.Assignments.Where(a => a.id == Int32.Parse(Request.Params["assignment_id"])).First();
     List<Question> quiz_questions = quiz.QuizQuestions.Select(a => a.Question).ToList();
     foreach (Question q in quiz_questions)
     {
         if (Request.Params[q.id.ToString()] != null)
         {
             Response resp = new Response();
             resp.question_id = q.id;
             resp.assignment_id = assignment.id;
             resp.response_content = Request.Params[q.id.ToString()];
             DocumentorDB.Responses.InsertOnSubmit(resp);
         }
     }
     DocumentorDB.SubmitChanges();
     //assignment.calculate_quiz_score();
     //quiz.score = score;
     //DocumentorDB.SubmitChanges();
     Random r = new Random();
     List<Docket> dockets = DocumentorDB.Dockets.ToList();
     int docket_index = r.Next(dockets.Count);
     return RedirectToAction("DocketDocumentsQuiz", new { assignment_id = assignment.id, docket_id = dockets[docket_index].id });
     //return View();
 }
コード例 #3
0
		private void detach_Responses(Response entity)
		{
			this.SendPropertyChanging();
			entity.Assignment = null;
		}
コード例 #4
0
		private void detach_Responses(Response entity)
		{
			this.SendPropertyChanging();
			entity.Question = null;
		}
コード例 #5
0
 partial void DeleteResponse(Response instance);
コード例 #6
0
 partial void UpdateResponse(Response instance);
コード例 #7
0
 partial void InsertResponse(Response instance);