コード例 #1
0
        public ActionResult CreateFirstUser(CreateFirstUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (GetCommand<CreateFirstUserCommand>().ExecuteCommand(model))
                {
                    usersModuleDescriptor.SetAsFirstUserRegistered();

                    return Redirect(FormsAuthentication.LoginUrl ?? "/");
                }
            }

            return View(model);
        }
コード例 #2
0
        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);
        }