diff --git a/csharp/app/Backend/Backend.csproj b/csharp/App/Backend/Backend.csproj
similarity index 72%
rename from csharp/app/Backend/Backend.csproj
rename to csharp/App/Backend/Backend.csproj
index c082226db..a63522893 100644
--- a/csharp/app/Backend/Backend.csproj
+++ b/csharp/App/Backend/Backend.csproj
@@ -1,10 +1,5 @@
-
-
- net6.0
- enable
- enable
-
+
@@ -26,17 +21,24 @@
-
-
- ..\..\..\..\..\..\.nuget\packages\awssdk.core\3.7.8.10\lib\netcoreapp3.1\AWSSDK.Core.dll
-
-
- ..\..\..\..\..\.nuget\packages\sqlite-net-pcl\1.8.116\lib\netstandard2.0\SQLite-net.dll
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
diff --git a/csharp/App/Backend/Controllers/Controller.cs b/csharp/App/Backend/Controllers/Controller.cs
new file mode 100644
index 000000000..46d6d67ad
--- /dev/null
+++ b/csharp/App/Backend/Controllers/Controller.cs
@@ -0,0 +1,390 @@
+using InnovEnergy.App.Backend.Database;
+using InnovEnergy.App.Backend.DataTypes;
+using InnovEnergy.App.Backend.DataTypes.Methods;
+using InnovEnergy.App.Backend.Relations;
+using Microsoft.AspNetCore.Mvc;
+using static System.Net.HttpStatusCode;
+using Folder = InnovEnergy.App.Backend.DataTypes.Folder;
+using Installation = InnovEnergy.App.Backend.DataTypes.Installation;
+using Object = System.Object;
+using User = InnovEnergy.App.Backend.DataTypes.User;
+
+namespace InnovEnergy.App.Backend.Controllers;
+
+[ApiController]
+[Route("api/")]
+public class Controller
+{
+ private static readonly HttpResponseMessage _Unauthorized = new HttpResponseMessage(Unauthorized);
+ private static readonly HttpResponseMessage _Ok = new HttpResponseMessage(OK);
+ private static readonly HttpResponseMessage _BadRequest = new HttpResponseMessage(BadRequest);
+
+ [Returns]
+ [Returns(Unauthorized)]
+ [Returns(BadRequest)]
+ [HttpPost($"{nameof(Login)}")]
+ public Object Login(Credentials credentials)
+ {
+ var session = credentials.Login();
+
+ return session is null
+ ? _Unauthorized
+ : session;
+ }
+
+
+ [Returns(OK)]
+ [Returns(Unauthorized)]
+ [HttpPost($"{nameof(Logout)}")]
+ public Object Logout()
+ {
+ var session = GetSession();
+
+ return session.Logout()
+ ? _Ok
+ : _Unauthorized;
+ }
+
+
+ [Returns]
+ [Returns(Unauthorized)]
+ [HttpGet($"{nameof(GetUserById)}")]
+ public Object GetUserById(Int64 id)
+ {
+ var caller = GetSession()?.User;
+ if (caller == null)
+ return _Unauthorized;
+
+ var user = Db.GetUserById(id);
+
+ if (user is null || !caller.HasAccessTo(user))
+ return _Unauthorized;
+
+ user.Password = "";
+ return user;
+ }
+
+
+ [Returns]
+ [Returns(Unauthorized)]
+ [HttpGet($"{nameof(GetInstallationById)}")]
+ public Object GetInstallationById(Int64 id)
+ {
+ var user = GetSession()?.User;
+ if (user == null)
+ return _Unauthorized;
+
+ var installation = Db.GetInstallationById(id);
+
+ if (installation is null || !user.HasAccessTo(installation))
+ return _Unauthorized;
+
+ return installation;
+ }
+
+ [Returns]
+ [Returns(Unauthorized)]
+ [HttpGet($"{nameof(GetUsersWithAccessToInstallation)}")]
+ public Object GetUsersWithAccessToInstallation(Int64 id)
+ {
+ var user = GetSession()?.User;
+ if (user == null)
+ return _Unauthorized;
+
+ var installation = Db.GetInstallationById(id);
+
+ if (installation is null || !user.HasAccessTo(installation))
+ return _Unauthorized;
+
+ var usersWithInheritedAccess = installation
+ .Ancestors()
+ .SelectMany(f => f.UsersWithDirectAccess()
+ .Where(u => u.IsDescendantOf(user))
+ .Select(u => new { folderId = f.Id, user = u }))
+ .OfType