Add API to update a course

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-06-19 13:19:22 +02:00
parent a151081be8
commit e1c2eedadb
2 changed files with 20 additions and 2 deletions

View file

@ -66,5 +66,13 @@ class TitamaApi {
return newCourse;
}
@ApiMethod(method: 'PUT', path: 'course/{id}')
Course updateCourse(int id, Course course) {
course.id = id;
int index = _courses.indexOf(_courses.singleWhere((crs) => crs.id == id));
_courses.replaceRange(index, index + 1, [course]);
return course;
}
}