Add API to delete a course

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-06-19 12:40:21 +02:00
parent b3835b2340
commit a151081be8
2 changed files with 15 additions and 6 deletions

View file

@ -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;