public async Task <IActionResult> SaveEmailAddress(PrincipalAuthorityEmailAddressViewModel model) { session.SetSubmittedPage(FormSection.SignUp, 1); if (await accountCreationPostDataHandler.ExistsAsync(model.EmailAddress)) { ViewData["doOverride"] = true; ModelState.AddModelError("EmailAddress", "A user with this email address already exists in the system."); } if (!ModelState.IsValid) { return(View(GetViewPath(FormSection.SignUp, 1), model)); } // Don't overwrite an unconfirmed user if we're currently editing that user if (!model.EmailAddress.Equals(session.GetString(CurrentPaEmail), StringComparison.InvariantCultureIgnoreCase)) { await accountCreationPostDataHandler.DeleteIfUnconfirmedAsync(model.EmailAddress); } session.SetString(CurrentPaEmail, model.EmailAddress); await accountCreationPostDataHandler.UpdateAsync(model.EmailAddress, model); return(CheckParentValidityAndRedirect(1)); }
public SignUpViewModel() { FullName = new PrincipalAuthorityFullNameViewModel(); EmailAddress = new PrincipalAuthorityEmailAddressViewModel(); Address = new AddressViewModel(); CommunicationPreference = new CommunicationPreferenceViewModel(); Password = new PasswordViewModel(); }