diff --git a/Vorprojekt/Vorprojekt/Backend verbindung.cs b/Vorprojekt/Vorprojekt/Backend verbindung.cs
index abf7c35..d5ec4ae 100644
--- a/Vorprojekt/Vorprojekt/Backend verbindung.cs
+++ b/Vorprojekt/Vorprojekt/Backend verbindung.cs
@@ -1,12 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net.Http;
using System.Text;
+using System.Text.Json.Nodes;
using System.Threading.Tasks;
+
namespace Vorprojekt
{
- internal class Backend_verbindung
+ public class Backend_verbindung
{
+
+
+
+ public JsonArray Datenbank(){
+ //Definiert die URL der REST-API, von der Daten abgerufen werden sollen.
+ //BITTE ANPASSEN AN EUREN PFAD!
+ string url = "http://localhost/PBDGS2H25ALA/Vorprojekt/restAPI.php";
+ // z.B. URL fürs Einloggen zusammensetzen
+ //url += "/user/login?username=Hansi&password=GeheimesPasswort123";
+
+ HttpClient client = new HttpClient();
+ //Führt eine GET-Anfrage an die URL aus.
+ //Es stehen auch DeleteAsync, PostAsync und PutAsync zur Verfügung
+ var response = client.GetAsync(url).Result;
+ //Liest den Inhalt des HTTP-Response als String (eigentlich ein JSON-Array) aus
+ string responseString = response.Content.ReadAsStringAsync().Result;
+ //Parst den JSON-String in ein JsonArray-Objekt.
+ //JsonNode.Parse() analysiert den JSON-Text und gibt ein JsonNode zurück, das hier in ein JsonArray umgewandelt wird.
+ JsonArray json = (JsonArray)JsonNode.Parse(responseString);
+ foreach (JsonObject item in json)
+ {
+ Console.WriteLine(item);
+ }
+
+ return null;
+ }
}
-}
+}
\ No newline at end of file
diff --git a/Vorprojekt/Vorprojekt/Vorprojekt.csproj b/Vorprojekt/Vorprojekt/Vorprojekt.csproj
index e3e33e3..5e5419e 100644
--- a/Vorprojekt/Vorprojekt/Vorprojekt.csproj
+++ b/Vorprojekt/Vorprojekt/Vorprojekt.csproj
@@ -8,4 +8,8 @@
true
+
+
+
+