public ActionResult CreateFirstUser(CreateFirstUserViewModel model) { if (ModelState.IsValid) { if (GetCommand<CreateFirstUserCommand>().ExecuteCommand(model)) { usersModuleDescriptor.SetAsFirstUserRegistered(); return Redirect(FormsAuthentication.LoginUrl ?? "/"); } } return View(model); }
public ActionResult CreateFirstUser(CreateFirstUserViewModel model) { if (usersModuleDescriptor.IsFirstUserRegistered) { throw new HttpException(403, "First user is already registered!"); } if (ModelState.IsValid) { if (GetCommand<CreateFirstUserCommand>().ExecuteCommand(model)) { usersModuleDescriptor.SetAsFirstUserRegistered(); return Redirect(FormsAuthentication.LoginUrl ?? "/"); } } return View(model); }