Esempio n. 1
0
        public ActionResult Index(DrpList drp)
        {
            ViewBag.drpData    = drp;
            ViewBag.questionNo = drp.QuestionNo;

            TempData["a"] = drp.QuestionNo;

            if (drp.QuestionNo == 1)
            //if (questionNo == null || id == null)
            {
                Session["exid"] = drp.examid;

                Questions_tbl SingleQuestion = db.Questions_tbl.SingleOrDefault(m => m.qus_id == 1 && m.exam_id == drp.examid);


                TempData["qData"] = SingleQuestion;
                return(RedirectToAction("NextQuestion"));
                //return View(SingleQuestion);
            }
            else
            {
                Questions_tbl SingleQuestion = db.Questions_tbl.SingleOrDefault(m => m.qus_id == drp.QuestionNo && m.exam_id == drp.examid);
                int           qus            = (int)drp.QuestionNo;

                //for (int i = 0; i <= drp.QuestionNo; i++)
                //{
                //    ViewBag.questionNo = qusno + i;
                //}


                return(View(SingleQuestion));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Questions_tbl safety_qs_tbl = db.Questions_tbl.Find(id);

            db.Questions_tbl.Remove(safety_qs_tbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public ActionResult NextQuestion()
        {
            int qNo = (int)TempData["a"];

            ViewBag.questionNo = qNo;
            Questions_tbl a = (Questions_tbl)TempData["qData"];

            return(View(a));
        }
 public ActionResult Edit([Bind(Include = "Q_ID,Question,AnsType,Available,TableType")] Questions_tbl safety_qs_tbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(safety_qs_tbl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(safety_qs_tbl));
 }
 public ActionResult Edit([Bind(Include = "all_qus_id,qus_id,admin_id,exam_id,qus_title,ans1,ans2,ans3,ans4,correct_ans")] Questions_tbl questions_tbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(questions_tbl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.admin_id = new SelectList(db.Admin_tbl, "admin_id", "admin_name", questions_tbl.admin_id);
     ViewBag.exam_id  = new SelectList(db.Exam_tbl, "exam_id", "exam_title", questions_tbl.exam_id);
     return(View(questions_tbl));
 }
        // GET: /Safety/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Questions_tbl safety_qs_tbl = db.Questions_tbl.Find(id);

            if (safety_qs_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(safety_qs_tbl));
        }
        // GET: /Quality/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Questions_tbl quality_qs_tbl = db.Questions_tbl.Find(id);

            if (quality_qs_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(quality_qs_tbl));
        }
        // GET: /Question/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Questions_tbl questions_tbl = db.Questions_tbl.Find(id);

            if (questions_tbl == null)
            {
                return(HttpNotFound());
            }
            ViewBag.admin_id = new SelectList(db.Admin_tbl, "admin_id", "admin_name", questions_tbl.admin_id);
            ViewBag.exam_id  = new SelectList(db.Exam_tbl, "exam_id", "exam_title", questions_tbl.exam_id);
            return(View(questions_tbl));
        }
Esempio n. 9
0
        public ActionResult NextQuestion(Questions_tbl aaa)
        {
            if (aaa.correct_ans == aaa.selectedvalue && aaa.qus_id != 1)
            {
                Session["correctAns"] = Convert.ToInt32(Session["correctAns"]) + 1;
            }
            else if (aaa.correct_ans == aaa.selectedvalue && aaa.qus_id == 1)
            {
                Session["correctAns"] = 1;
            }

            if (aaa.qus_id == 10)
            {
                return(RedirectToAction("Create", "Result"));
            }
            int           qId            = (int)aaa.qus_id + 1;
            Questions_tbl SingleQuestion = db.Questions_tbl.SingleOrDefault(m => m.qus_id == qId && m.exam_id == aaa.exam_id);


            ViewBag.questionNo = qId;
            TempData["a"]      = SingleQuestion.qus_id;
            TempData["qData"]  = SingleQuestion;
            return(RedirectToAction("NextQuestion"));
        }