public ActionResult Signup(UserModel model) { if(ModelState.IsValid) { try { _userService.Signup(model); return RedirectToAction("Login"); } catch(ValidationException e) { ModelState.AddModelError(e.Key, e.Description); } } return View("Signup", model); }
public void Signup(UserModel model) { model.Password = PasswordHash.CreateHash(model.Password); _userRepository.Add(Mapper.Map<UserModel, User>(model)); _userRepository.Save(); }