aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-02 23:44:50 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-02 23:44:50 +0100
commit311c84b1bf0fa3a9680b16ba1ec3309a0a1dca1f (patch)
tree987a2b00e211e56298f257834bef29bb268a6274 /sandbox/testAppSonja/frontend/front/src/app/services/student.service.ts
parente3999e37a0a0018be4704ed58b7d984781f429c8 (diff)
parentee11a13a99d5635eb27850bcd909b73e6f50fced (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar
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.ts31
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);
+ }
+}