diff --git a/.idea/.idea.FoodsharingSiegen/.idea/misc.xml b/.idea/.idea.FoodsharingSiegen/.idea/misc.xml
deleted file mode 100644
index 283b9b4..0000000
--- a/.idea/.idea.FoodsharingSiegen/.idea/misc.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/FoodsharingSiegen.Contracts/FoodsharingSiegen.Contracts.csproj b/FoodsharingSiegen.Contracts/FoodsharingSiegen.Contracts.csproj
index 445c813..1ebf973 100644
--- a/FoodsharingSiegen.Contracts/FoodsharingSiegen.Contracts.csproj
+++ b/FoodsharingSiegen.Contracts/FoodsharingSiegen.Contracts.csproj
@@ -1,13 +1,13 @@
- net6.0
+ net9.0
enable
enable
-
+
diff --git a/FoodsharingSiegen.Server/Extensions.cs b/FoodsharingSiegen.Server/Extensions.cs
new file mode 100644
index 0000000..becd649
--- /dev/null
+++ b/FoodsharingSiegen.Server/Extensions.cs
@@ -0,0 +1,59 @@
+using FoodsharingSiegen.Server.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration.Json;
+
+namespace FoodsharingSiegen.Server
+{
+ public static class Extensions
+ {
+ #region Public Method AddDatabaseContext
+
+ ///
+ /// Configures the application's data access layer by setting up and registering a database context using SQLite.
+ /// Ensures the database file is stored within the application's base directory under a "data" folder.
+ ///
+ /// An instance of used to configure the application's services and resources.
+ public static void AddDatabaseContext(this WebApplicationBuilder builder)
+ {
+ var dataDirectory = Path.Combine(AppContext.BaseDirectory, "data");
+ if (!Directory.Exists(dataDirectory)) Directory.CreateDirectory(dataDirectory);
+
+ var dbPath = Path.Combine(dataDirectory, "app.db");
+ var connectionString = $"Data Source={dbPath}";
+
+ builder.Services.AddDbContextFactory(options =>
+ options.UseSqlite(connectionString));
+ }
+
+ #endregion
+
+ #region Public Method LoadAppSettings
+
+ ///
+ /// Loads application settings from JSON configuration files located in a designated "config" directory.
+ /// Clears existing JSON configuration files and ensures settings from the specified files are applied.
+ ///
+ /// An instance of used to configure and load application settings.
+ public static void LoadAppSettings(this WebApplicationBuilder builder)
+ {
+ // Clear loaded json files
+ foreach (var configurationSource in builder.Configuration.Sources.Where(x => x is JsonConfigurationSource).ToList())
+ builder.Configuration.Sources.Remove(configurationSource);
+
+ // Define the directory where your appsettings files reside
+ var configDir = Path.Combine(builder.Environment.ContentRootPath, "config");
+
+ // Check if the directory exists
+ if (Directory.Exists(configDir))
+ {
+ // Get all JSON files that start with "appsettings" in the directory and its subdirectories
+ var configFiles = Directory.EnumerateFiles(configDir, "appsettings*.json", SearchOption.AllDirectories);
+
+ // Add each file to the configuration
+ foreach (var file in configFiles) builder.Configuration.AddJsonFile(file, true, true);
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/FoodsharingSiegen.Server/FoodsharingSiegen.Server.csproj b/FoodsharingSiegen.Server/FoodsharingSiegen.Server.csproj
index 07349be..420c8e1 100644
--- a/FoodsharingSiegen.Server/FoodsharingSiegen.Server.csproj
+++ b/FoodsharingSiegen.Server/FoodsharingSiegen.Server.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net9.0
enable
enable
@@ -19,14 +19,14 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+
diff --git a/FoodsharingSiegen.Server/Pages/_Layout.cshtml b/FoodsharingSiegen.Server/Pages/_Layout.cshtml
index 6d22dbd..226eb84 100644
--- a/FoodsharingSiegen.Server/Pages/_Layout.cshtml
+++ b/FoodsharingSiegen.Server/Pages/_Layout.cshtml
@@ -20,11 +20,12 @@
-
-
-
+
+
+
-
+
+
@@ -43,6 +44,6 @@
-
+