Пример #1
0
 private ActionResult RetryRegister(RegistrationViewModel registration)
 {
     return View("../Home/Index", new HomeViewModel
     {
         Login = new LoginViewModel(),
         Registration = registration
     });
 }
Пример #2
0
 private ActionResult RegisterNewUser(RegistrationViewModel registration)
 {
     var user = UserMapper.Map(registration);
     try
     {
         Service.Register(user, registration.Password);
         Service.Login(user.Email, registration.Password);
         return RedirectToAction("Index", "Profile");
     }
     catch (SecurityCreateUserException exception)
     {
         ModelState.AddModelError("", exception.Message);
         return RetryRegister(registration);
     }
 }
Пример #3
0
 public ActionResult Register(RegistrationViewModel registration)
 {
     return ModelState.IsValid
         ? RegisterNewUser(registration)
         : RetryRegister(registration);
 }