mirror of
https://github.com/Stefan-5422/-T5-Elektrifikatsiya.git
synced 2026-09-10 07:36:02 +02:00
UHHHM
* Added Login System * Added Query from Prom * Changed Dashboard to display data
This commit is contained in:
@@ -4,6 +4,7 @@ using Blazorise.Icons.Material;
|
||||
using Blazorise.Material;
|
||||
|
||||
using Elektrifikatsiya.Database;
|
||||
using Elektrifikatsiya.Models;
|
||||
using Elektrifikatsiya.Services;
|
||||
using Elektrifikatsiya.Services.Implementations;
|
||||
|
||||
@@ -51,7 +52,16 @@ app.MapFallbackToPage("/_Host");
|
||||
app.MapControllers();
|
||||
|
||||
IServiceScope serviceScope = app.Services.GetRequiredService<IServiceScopeFactory>().CreateScope();
|
||||
serviceScope.ServiceProvider.GetRequiredService<MainDatabaseContext>().Database.EnsureCreated();
|
||||
|
||||
MainDatabaseContext mainDatabase = serviceScope.ServiceProvider.GetRequiredService<MainDatabaseContext>();
|
||||
mainDatabase.Database.EnsureCreated();
|
||||
|
||||
IAuthenticationService authenticationService = serviceScope.ServiceProvider.GetRequiredService<IAuthenticationService>();
|
||||
|
||||
if (!mainDatabase.Users.Any())
|
||||
{
|
||||
authenticationService.RegisterUserAsync("admin", "admin", Role.Admin);
|
||||
}
|
||||
|
||||
app.Run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user