diff options
author | TAMARA JERINIC <tamara.jerinic@gmail.com> | 2022-03-02 23:38:27 +0100 |
---|---|---|
committer | TAMARA JERINIC <tamara.jerinic@gmail.com> | 2022-03-02 23:38:27 +0100 |
commit | dce4e644d5e5d9c97ff5ac337448b52f2a2a64fd (patch) | |
tree | ffdb31f43958e8c557647a4bd61914d6d13486e4 /sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts | |
parent | 9826a8079ffcd1d849a8a8821696d51691606133 (diff) |
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into Tamara
# Conflicts:
# .gitignore
Diffstat (limited to 'sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts')
-rw-r--r-- | sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts b/sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts new file mode 100644 index 00000000..b0eb60cc --- /dev/null +++ b/sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts @@ -0,0 +1,31 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Student } from '../Student'; + +@Injectable({ + providedIn: 'root' +}) +export class StudentService { + + constructor(private http: HttpClient) { } + + public getStudents() { + return this.http.get<Student[]>(`http://localhost:5000/api/students`); + } + + public getOneStudent(id: number) { + return this.http.get<any>("http://localhost:5000/api/students/" + id); + } + + public updateStudent(id: number, student: Student) { + return this.http.put("http://localhost:5000/api/students/" + student.id, student); + } + + public deleteStudent(id: number) { + return this.http.delete("http://localhost:5000/api/students/" + id); + } + + public addStudent(newStudent: Student) { + return this.http.post("http://localhost:5000/api/students/", newStudent); + } +} |