Пример #1
0
        public ActionResult QDetail(int id)
        {
            var dao     = new AdminDao();
            var session = (AdminLogin)Session[CommonConstants.USER_SESSION];

            if (session.id_permission == 2)
            {
                return(View("Error"));
            }
            ViewBag.AdminName = session.name;


            var dao2 = new SubjectDao().ViewDetail(id);
            var dao1 = new QuestionDao().ListQuestionInSubject(id);

            if (dao2 == null)
            {
                return(View("Error"));
            }
            else
            {
                dao.UpdateLastLogin(session.id_admin);
                dao.UpdateLastSeen("Xem các câu hỏi của môn học " + dao2.subject_name, "/Admin/Subject/QDetail" + dao2.id_subject, session.id_admin);
                TempData["subject_name"] = dao2.subject_name;
                TempData["id_subject"]   = id;
                var list = dao1.ToList();
                foreach (var item in list)
                {
                    item.question_content = RemoveHtml(RemoveFomula(item.question_content));
                    if (item.question_content.Length >= 90)
                    {
                        item.question_content = item.question_content.Substring(0, 90) + "....";
                    }
                }

                return(View(list));
            }
        }