コード例 #1
0
ファイル: UserController.cs プロジェクト: nogalskisam/Fyl
        public async Task<ActionResult> Register(RegisterModel model)
        {
            if (model.Password != model.PasswordConfirm)
            {
                model.Password = null;
                model.PasswordConfirm = null;

                ModelState.AddModelError("", "Passwords do not match!");
            }

            if (ModelState.IsValid)
            {
                RegistrationResponseDto response = await _landlordService.RegisterUser(model.ToLandlordDto());

                if (response.Success)
                {
                    return RedirectToAction("Success", "User");
                }

                if (response.EmailExists)
                {
                    ModelState.AddModelError("EmailAddress", "Email address already exists");
                }
            }

            return View(model);
        }
コード例 #2
0
ファイル: UserController.cs プロジェクト: nogalskisam/Fyl
        public ActionResult Register()
        {
            var model = new RegisterModel();

            return View("Register", model);
        }