Fixed errors on website loading

Fixed the errors that occurred on initial website load by moving the initial user creation in the DBContext and not in the ASP.NET project
This commit is contained in:
Dimitar Todorov
2022-04-01 23:22:57 +03:00
parent b36a4df097
commit 0ab907582c
8 changed files with 30 additions and 56 deletions

View File

@@ -95,7 +95,7 @@ namespace WebApp.Areas.Identity.Pages.Account
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
if (ModelState.IsValid)
{
var user = new User { Id = Guid.NewGuid().ToString(), UserName = Input.UserName, Email = Input.Email, FirstName = Input.FirstName, LastName = Input.LastName, PhoneNumber = Input.PhoneNumber, PersonalNumber = Input.EGN, IsAdmin = Input.IsAdmin};
var user = new User { Id = Guid.NewGuid().ToString(), UserName = Input.UserName, Email = Input.Email, FirstName = Input.FirstName, LastName = Input.LastName, PhoneNumber = Input.PhoneNumber, PersonalNumber = Input.EGN};
var result = await _userManager.CreateAsync(user, Input.Password);
if (result.Succeeded)
{