@if (hotel && !alert) {
-
Name: {{ hotel.hotelName }}
-
Beschreibung: {{ hotel.description }}
-
Preis: {{ hotel.price | currency: currency.currency : 'symbol' : '2.2-2' : currency.code }}/nacht
-
Sterne:
-
-
-
+
} @else if(alert) {
{{alert}}
} @else {
@@ -55,4 +51,8 @@ export class HotelComponent implements OnInit {
}))
.subscribe({next: (hotel: Hotel) => {this.hotel = hotel}})
}
+
+ update(hotel: Hotel): void {
+ this.hotelService.updateHotelById(hotel).subscribe()
+ }
}
diff --git a/src/app/service/hotel.service.ts b/src/app/service/hotel.service.ts
index a55859f..2a86f7e 100644
--- a/src/app/service/hotel.service.ts
+++ b/src/app/service/hotel.service.ts
@@ -16,4 +16,12 @@ export class HotelService {
public getHotelById(id: number): Observable
{
return this.httpClient.get(`/api/hotels/${id}`);
}
+
+ public updateHotelById(hotel: Hotel): Observable