public async Task <IActionResult> SignUpOrganization(SignUpOrganizationViewModel model) { if (ModelState.IsValid) { IdentityUser identityUser = new IdentityUser { UserName = model.Email, Email = model.Email }; var result = await userManager.CreateAsync(identityUser, model.Password); if (result.Succeeded) { await signInManager.SignInAsync(identityUser, isPersistent : false); var recupero = await userManager.GetUserAsync(HttpContext.User); Organization organization = new Organization { Name = model.Name, Description = model.Description, Identity = recupero }; organizationRepository.CreateOrganization(organization); return(RedirectToAction("Index", "Home")); } foreach (var error in result.Errors) { ModelState.AddModelError("", error.Description); } } return(View(model)); }