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)); }
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)); }
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)); }