Пример #1
0
 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);
 }
Пример #2
0
 public void Signup(UserModel model)
 {
     model.Password = PasswordHash.CreateHash(model.Password);
     _userRepository.Add(Mapper.Map<UserModel, User>(model));
     _userRepository.Save();
 }