Exemplo n.º 1
0
 public ActionResult QuestionLimit()
 {
     TempData["Prof"]         = "";
     ViewBag.Departments      = ExamDALC.GetProfs();
     ViewBag.ParentCategories = ExamDALC.GetCategories().Where(r => r.Item3 == 0).ToList();
     return(View());
 }
Exemplo n.º 2
0
        public ActionResult Insert()
        {
            var referer    = Request.ServerVariables["http_referer"];
            var categoreis = ExamDALC.GetCategories();

            ViewBag.parentCategories = categoreis.Where(row => row.Item3 == 0).OrderBy(row => row.Item1).ToList();
            ViewBag.subCategories    = categoreis.Where(row => row.Item3 == 1).ToList();
            ViewBag.questions        = ExamDALC.GetQuestions();
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult Insert(ExamViewModel model)
        {
            var categoreis = ExamDALC.GetCategories();

            if (!ModelState.IsValid)
            {
                ViewBag.parentCategories = categoreis.Where(row => row.Item3 == 0).ToList();
                ViewBag.subCategories    = categoreis.Where(row => row.Item3 == 1).ToList();
                ViewBag.questions        = ExamDALC.GetQuestions();
                return(View());
            }
            bool   result  = false;
            string message = "";

            result  = ExamDALC.InsertQuestion(MaptoExamDomainModel(model));
            message = result ? model.ID > 0 ? "#successE" : "#successI" : "#error";
            //var categoreis = ExamDALC.GetCategories();
            ViewBag.parentCategories = categoreis.Where(row => row.Item3 == 0).ToList();
            ViewBag.subCategories    = categoreis.Where(row => row.Item3 == 1).ToList();
            ViewBag.questions        = ExamDALC.GetQuestions();
            return(new RedirectResult(Url.Action("Insert", "Exam") + message));
        }
Exemplo n.º 4
0
        public JsonResult GetSubCategories(int id)
        {
            var subCategories = ExamDALC.GetCategories().Where(row => row.Item3 == id).ToList();

            return(Json(new { data = subCategories }, JsonRequestBehavior.AllowGet));
        }