Example #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var _examDao = new ExamDAO();
            var _exam    = _examDao.GetExamById(id);

            if (_exam == null)
            {
                return(HttpNotFound());
            }
            var _listClass = _examDao.GetClassSelected(_exam);

            int[] _selectedClassID = new int[_listClass.Count];
            for (int i = 0; i < _listClass.Count; i++)
            {
                _selectedClassID[i] = _listClass[i].Id;
            }
            _exam.SelectedClassID = _selectedClassID;

            SetClassViewBag(_exam.SelectedClassID);
            SetGradeViewBag(_exam.Subject.GradeID);
            SetSubjectViewBag(_exam.SubjectID);
            SetSchoolYearViewBag(_exam.Subject.Grade.SchoolYearID);
            SetUserViewBag(_exam.UserID);

            return(View(_exam));
        }
Example #2
0
        public JsonResult GetClassSelected(int?id)
        {
            var _examDao  = new ExamDAO();
            var _classDao = new ClassDAO();

            var _exam      = _examDao.GetExamById(id);
            var _listClass = _examDao.GetClassSelected(_exam);

            int[] _selectedClassID = new int[_listClass.Count];
            for (int i = 0; i < _listClass.Count; i++)
            {
                _selectedClassID[i] = _listClass[i].Id;
            }
            _exam.SelectedClassID = _selectedClassID;
            return(Json(_exam.SelectedClassID, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var _examDao = new ExamDAO();
            var _exam    = _examDao.GetExamById(id);

            if (_exam == null)
            {
                return(HttpNotFound());
            }
            SetUserViewBag(_exam.UserID);
            var _listClass = _examDao.GetClassSelected(_exam);

            int[] _selectedClassID = new int[_listClass.Count];
            for (int i = 0; i < _listClass.Count; i++)
            {
                _selectedClassID[i] = _listClass[i].Id;
            }
            SetClassViewBag(_selectedClassID);
            return(View(_exam));
        }