diff --git a/Helios/Controllers/LoginController.cs b/Helios/Controllers/LoginController.cs index c743abb6c3efc5c8eda71fce372672d9381aee1e..dee929c295f7aa56e94fc1b579374ecb9906e5af 100644 --- a/Helios/Controllers/LoginController.cs +++ b/Helios/Controllers/LoginController.cs @@ -26,22 +26,12 @@ namespace Helios.Controllers if (userAccount.IsAdmin) { - return RedirectToAction("Admin"); + return RedirectToAction("Admin", "UserController"); } else { - return RedirectToAction("User"); + return RedirectToAction("User", "UserController"); } } - - public ActionResult User() - { - return View(); - } - - public ActionResult Admin() - { - return View(); - } } } \ No newline at end of file diff --git a/Helios/Controllers/UserController.cs b/Helios/Controllers/UserController.cs new file mode 100644 index 0000000000000000000000000000000000000000..10200b42fdd7969a962cb40275ddf7ba190c5c86 --- /dev/null +++ b/Helios/Controllers/UserController.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 + +namespace Helios.Controllers +{ + public class UserController : Controller + { + + + public IActionResult Admin() + { + return View(); + } + + public IActionResult User() + { + return View(); + } + } +} + diff --git a/Helios/Helios.csproj b/Helios/Helios.csproj index 94eff889a551ff3407508f9987e16dae6a3f74ac..b5a6255bda04b628ebde312cd6cde54f1b7934f0 100644 --- a/Helios/Helios.csproj +++ b/Helios/Helios.csproj @@ -13,11 +13,13 @@ <None Remove="Swashbuckle.AspNetCore" /> <None Remove="Views\Login\" /> <None Remove="Views\Configurator\" /> + <None Remove="Views\User\" /> </ItemGroup> <ItemGroup> <Folder Include="Source\" /> <Folder Include="Views\Login\" /> <Folder Include="Views\Configurator\" /> + <Folder Include="Views\User\" /> </ItemGroup> <ItemGroup> <PackageReference Include="Npgsql" Version="6.0.4" /> diff --git a/Helios/Models/Admin.cs b/Helios/Models/Admin.cs new file mode 100644 index 0000000000000000000000000000000000000000..caaa4f657bc3e0fa80533643e5cec64ed37b798c --- /dev/null +++ b/Helios/Models/Admin.cs @@ -0,0 +1,11 @@ +using System; +namespace Helios.Models +{ + public class Admin + { + public Admin() + { + } + } +} + diff --git a/Helios/Models/User.cs b/Helios/Models/User.cs new file mode 100644 index 0000000000000000000000000000000000000000..7f0d510a9b2406e5e939a1654d80d5bf7efb53e9 --- /dev/null +++ b/Helios/Models/User.cs @@ -0,0 +1,9 @@ +using System; +namespace Helios.Models +{ + public class User + { + public User() { } + } +} + diff --git a/Helios/Program.cs b/Helios/Program.cs index 3873c5c71dad36132c0d50c4eea47b729415713b..a3c4a06b080d9337e03c7488c3d48567f2860549 100644 --- a/Helios/Program.cs +++ b/Helios/Program.cs @@ -11,6 +11,9 @@ builder.Services.AddTransient<LoginService>(provider builder.Services.AddTransient<ConfiguratorService>(provider => new ConfiguratorService(builder.Configuration.GetConnectionString("default"))); +builder.Services.AddTransient<UserService>(provider + => new UserService(builder.Configuration.GetConnectionString("default"))); + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/Helios/Source/UserService.cs b/Helios/Source/UserService.cs new file mode 100644 index 0000000000000000000000000000000000000000..b8c5b12b3da5695981f421a1431edcf7c9bf2df9 --- /dev/null +++ b/Helios/Source/UserService.cs @@ -0,0 +1,19 @@ +using System; +using Npgsql; + +namespace Helios.Source +{ + public class UserService + { + private readonly NpgsqlConnection _connection; + + public UserService(string connectionString) + { + _connection = new NpgsqlConnection(connectionString); + } + + + + } +} +