public ActionResult Create(FullAccountCreationInfo accountCreationInfo) { bool valid = true; if (!_validator.IsDisplayNameValid(accountCreationInfo.DisplayName)) { ModelState.AddModelError("DisplayName", "Display name is invalid"); valid = false; } if (!_validator.IsEmailValid(accountCreationInfo.EmailAddress)) { ModelState.AddModelError("EmailAddress", "Email Address is invalid"); valid = false; } if (!valid) { return(View(accountCreationInfo)); } if (!_validator.IsDuplicateEmailAddress(accountCreationInfo.EmailAddress)) { ModelState.AddModelError("EmailAddress", "Email address already exists"); return(View(accountCreationInfo)); } _accountCreator.CreateAccount(accountCreationInfo); return(new RedirectResult("Home")); }
public ActionResult Create() { FullAccountCreationInfo accountCreationInfo = new FullAccountCreationInfo(); return(View(accountCreationInfo)); }