Implemented course/{id} API

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-06-14 21:47:25 +02:00
parent 1e456059cb
commit ca3c119adb

View file

@ -40,6 +40,14 @@ class TitamaApi {
return _courses;
}
@ApiMethod(path: 'course/{id}')
Course getCourse(int id) {
for (Course course in _courses) {
if (course.id == id) {
return course;
}
}
throw new NotFoundError('Could not find course \'$id\'.');
}
}