Ejemplo n.º 1
0
        public List <Course> GetCourse(int uid)
        {
            StudentCS studentCS = new StudentCS();
            CourseServiceDecorator courseServiceDecorator = new CourseServiceDecorator(studentCS);

            return(courseServiceDecorator.QueryCourse(uid));
        }
Ejemplo n.º 2
0
        public IActionResult DeleteCourse(int course_id)
        {
            TeacherCS teacherCS = new TeacherCS();
            CourseServiceDecorator courseServiceDecorator = new CourseServiceDecorator(teacherCS);
            Course course = MysqlClient.getCourseById(course_id);

            courseServiceDecorator.DeleteCourse(1, course);
            return(Ok(db.Courses));
        }
Ejemplo n.º 3
0
        public IActionResult DeleteNew(int user_id, int course_id)
        {
            StudentCS studentCS = new StudentCS();
            CourseServiceDecorator courseServiceDecorator = new CourseServiceDecorator(studentCS);
            Course course = new Course();

            course = MysqlClient.getCourseById(course_id);
            courseServiceDecorator.DeleteCourse(user_id, course);
            return(Ok(db.Scourses));
        }
Ejemplo n.º 4
0
        public IActionResult AddNewCourse(string courseName, string teacherName, string progress, string kind, string representive)
        {
            TeacherCS teacherCS = new TeacherCS();
            CourseServiceDecorator courseServiceDecorator = new CourseServiceDecorator(teacherCS);
            Course course = new Course();

            course.CourseName   = courseName;
            course.TeacherName  = teacherName;
            course.Progress     = progress;
            course.Kind         = kind;
            course.Representive = representive;
            courseServiceDecorator.AddCourse(1, course);
            return(Ok(db.Courses));
        }
Ejemplo n.º 5
0
        public IActionResult AlterNew(int cid, string change, int type)
        {
            TeacherCS teacherCS = new TeacherCS();
            CourseServiceDecorator courseServiceDecorator = new CourseServiceDecorator(teacherCS);
            Course course = MysqlClient.getCourseById(cid);

            switch (type)
            {
            case 0: course.CourseName = change; break;

            case 1: course.Progress = change; break;

            case 2: course.Kind = change; break;

            case 3: course.Representive = change; break;
            }
            courseServiceDecorator.AlterCourse(course, type);
            return(Ok(db.Courses));
        }