示例#1
0
        public IActionResult Delteacher()
        {
            TeacherMethod method = new TeacherMethod();
            var           Lists  = method.ReadDB();

            ViewBag.teachers = Lists;
            return(View());
        }
        public IActionResult ChangeInformation()
        {
            TeacherMethod userfunction = new TeacherMethod();

            this.Request.Cookies.TryGetValue("Tno", out string value);
            string  no      = value;
            Teacher teacher = userfunction.GetTeacher(no);

            ViewBag.teacher = teacher;
            return(View());
        }
示例#3
0
        /// <summary>
        /// 增加一个教师
        /// </summary>
        /// <param name="teacher"></param>
        /// <returns></returns>
        public IActionResult AddteacherMethod(Teacher teacher)
        {
            TeacherMethod method = new TeacherMethod();

            if (method.Addteacher(teacher))
            {
                return(Content("<script>alert('添加成功');window.location.href='../Administrator/Delteacher';</script>", "text/html;charset=UTF-8"));
            }

            else
            {
                return(Content("<script>alert('添加失败');history.go(-1);</script>", "text/html;charset=UTF-8"));
            }
        }
示例#4
0
        /// <summary>
        /// 教师授课信息变动页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ModifyTC()
        {
            TeacherMethod teacher    = new TeacherMethod();
            TCmethod      cmethod    = new TCmethod();
            var           courses    = new List <List <Course> >();
            var           Allteacher = teacher.ReadDB();

            foreach (var infor in Allteacher)
            {
                courses.Add(cmethod.GetCourseByTno(infor.Tno));
            }
            ViewBag.courses  = courses;
            ViewBag.teachers = Allteacher;
            return(View());
        }
示例#5
0
        /// <summary>
        /// 输出一个老师所教授的所有课程
        /// </summary>
        /// <param name="Teacher_id"></param>
        /// <returns></returns>
        public IActionResult   ShowTC(string Teacher_id)
        {
            TeacherMethod method = new TeacherMethod();

            if (method.GetTeacher(Teacher_id) != null)
            {
                TCmethod cmethod = new TCmethod();
                ViewBag.courses = cmethod.GetCourseByTno(Teacher_id);
                ViewBag.Tno     = Teacher_id;
                return(View());
            }
            else
            {
                return(Content("<script>alert('该教师不存在');history.go(-1);</script>", "text/html;charset=UTF-8"));
            }
        }
示例#6
0
 /// <summary>
 /// 删除一个教师
 /// </summary>
 /// <param name="teacher_id"></param>
 /// <returns></returns>
 public IActionResult Delteamethod(string teacher_id)
 {
     using (var dbcontext = new srContext())
     {
         var infor = dbcontext.Teacher.FirstOrDefault(u => u.Tno == teacher_id);
         if (infor != null)
         {
             TeacherMethod method = new TeacherMethod();
             method.Delete(teacher_id);
             return(Content("<script>alert('删除成功');window.location.href='../Administrator/Delteacher';</script>", "text/html;charset=UTF-8"));
         }
         else
         {
             return(Content("<script>alert('该教师不存在');history.go(-1);</script>", "text/html;charset=UTF-8"));
         }
     }
 }