public void SetEmployeeId(RentCarUser user) { _instance = new UserInfo() { EmployeeId = user.EmployeeId }; }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if (ModelState.IsValid) { var user = new RentCarUser { UserName = Input.UserName, EmployeeId = Input.EmployeeId }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } EmployeesList = new SelectList(await _employeeService.GetAll(), nameof(Employee.Id), nameof(Employee.FullName)); // If we got this far, something failed, redisplay form return(Page()); }