Пример #1
0
        public ActionResult GetTopicStudent(string course_id)
        {
            CommonFunc        cFunc  = new CommonFunc();
            TopicDAO          tDAO   = new TopicDAO();
            CourseDAO         cDAO   = new CourseDAO();
            COURSE            course = cDAO.GetCourseByID(course_id);
            List <TOPIC>      topics = tDAO.GetAllTopicOfStudentCourse(cFunc.GetIdUserBySession(), course_id);
            CourseDetailsView model  = new CourseDetailsView();

            model.course = course;
            model.topics = topics;
            return(View(model));
        }
Пример #2
0
        public ActionResult PostTopic(TOPIC topic)
        {
            TopicDAO topicDao = new TopicDAO();

            if (topicDao.InsertTopic(topic))
            {
                CommonFunc cf = new CommonFunc();
                cf.DelCookieFile();
                return(Json(new { success = true }));
            }

            return(Json(new { success = false }));
        }
Пример #3
0
        public async Task <JsonResult> DeleteTopic(string id)
        {
            TopicDAO      topicDao = new TopicDAO();
            DocumentDAO   docDao   = new DocumentDAO();
            List <string> titles   = docDao.GetTitleDocByTopicID(id);

            if (topicDao.DeleteTopic(id))
            {
                foreach (var title in titles)
                {
                    await Delete(title);  //xoa file tren firebase
                }
                return(Json(new { success = true }));
            }
            return(Json(new { success = false }));
        }
Пример #4
0
        public JsonResult GetTopic(string courseId)//string userId, string courseId, string subjectId)
        {
            CommonFunc cFunc = new CommonFunc();

            if (cFunc.GetSession() != null)
            {
                TopicDAO     topicDao      = new TopicDAO();
                List <TOPIC> topicEntities = new List <TOPIC>();

                topicEntities = topicDao.GetAllTopicOfTeacherCourse(cFunc.GetIdUserBySession(), cFunc.GetIdSemesterBySession(), courseId);

                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string json = serializer.Serialize(topicEntities);
                return(Json(new { data = json, status = true }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { data = "/Home/Error", status = false }));
        }