Add API to delete a course
This commit is contained in:
parent
b3835b2340
commit
a151081be8
2 changed files with 15 additions and 6 deletions
|
@ -53,6 +53,12 @@ class TitamaApi {
|
|||
throw new NotFoundError('Could not find course \'$id\'.');
|
||||
}
|
||||
|
||||
@ApiMethod(method: 'DELETE', path: 'course/{id}')
|
||||
List<Course> deleteCourse(int id) {
|
||||
_courses.removeWhere((course) => course.id == id);
|
||||
return _courses;
|
||||
}
|
||||
|
||||
@ApiMethod(method: 'POST', path: 'course')
|
||||
Course addCourse (Course newCourse) {
|
||||
newCourse.id = _courses.length;
|
||||
|
|
Reference in a new issue