Last change
on this file since 8423429 was 8423429, checked in by AngelNasev <angel.nasev@…>, 17 months ago |
Add backend and frontend projects
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[8423429] | 1 | import { Injectable } from '@angular/core';
|
---|
| 2 | import {HttpClient, HttpParams} from "@angular/common/http";
|
---|
| 3 | import {Observable} from "rxjs";
|
---|
| 4 | import {StudentCourseInterface} from "./StudentCourseInterface";
|
---|
| 5 | import {ProfessorCourseInterface} from "./ProfessorCourseInterface";
|
---|
| 6 |
|
---|
| 7 | @Injectable({
|
---|
| 8 | providedIn: 'root'
|
---|
| 9 | })
|
---|
| 10 | export class AddStudentCoursesService {
|
---|
| 11 |
|
---|
| 12 | url = "http://localhost:8080/api/student-courses/add"
|
---|
| 13 | urlProf = "http://localhost:8080/api/professor-courses/add"
|
---|
| 14 |
|
---|
| 15 | constructor(private http: HttpClient) { }
|
---|
| 16 |
|
---|
| 17 | addCourseToStudent(username: string, selectedCourse: number) :Observable<StudentCourseInterface> {
|
---|
| 18 | const params = new HttpParams().append('username', username).append("selectedCourse",selectedCourse);
|
---|
| 19 | return this.http.get<StudentCourseInterface>(this.url, {params: params})
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | addCourseToProfessor(username: string, selectedCourse: number) : Observable<ProfessorCourseInterface> {
|
---|
| 23 | const params = new HttpParams().append('username', username).append("selectedCourse",selectedCourse);
|
---|
| 24 | return this.http.get<ProfessorCourseInterface>(this.urlProf, {params: params})
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.