public async Task <IActionResult> Register(RegistationViewModel registationViewModel) { if (ModelState.IsValid) { AppUser user = new AppUser { Email = registationViewModel.Email, UserName = registationViewModel.Email }; IdentityResult result = await _userManager.CreateAsync(user, registationViewModel.Password); if (result.Succeeded) { return(RedirectToAction("Index")); } else { foreach (IdentityError error in result.Errors) { this.ModelState.AddModelError("", error.Description); } } } return(View(registationViewModel)); }
public RegistrationWindow() { InitializeComponent(); DataContext = new RegistationViewModel(this); }