Add API to update a course
This commit is contained in:
parent
a151081be8
commit
e1c2eedadb
2 changed files with 20 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue