1234567891011121314151617181920212223242526272829303132333435363738 |
- function HttpService(server) {
- this.getStudents = function() {
- return $.ajax({
- url: server + '/students'
- });
- }
- this.getStudentsById = function(studentId) {
- return $.ajax({
- url: server + '/students/' + studentId,
- method: 'GET'
- });
- }
- this.updateUserById = function(studentId, data) {
- return $.ajax({
- url: server + '/students/' + studentId,
- method: 'PUT',
- data: data
- });
- }
- this.createStudent = function(data) {
- return $.ajax({
- url: server + '/students',
- method: 'POST',
- data: data
- });
- }
- this.deleteStudent = function(studentId) {
- return $.ajax({
- url: server + '/students/' + studentId,
- method: 'DELETE'
- })
- }
- }
|