public ActionResult Register(Register register) { var succeeded = _accountService.RegisterUser(register); var message = succeeded ? "User successfully registered" : string.Format("User with email '{0}' already exist.", register.Email); return Json(new { succeeded = succeeded, message = message}); }
public User Map(Register register) { return new User { Email = register.Email, Password = register.Password }; }
public static Register MakeRegister(string email, string password) { var register = new Register { Email = email, Password = password, ConfirmPassword = password }; return register; }
public bool RegisterUser(Register register) { var succeeded = false; var user = _userMapper.Map(register); using (var session = _documentStore.OpenSession()) { var alreadyregistered = (session.Query<User>() .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) .Count(u => u.Email == register.Email)) > 0; if (!alreadyregistered) { session.Store(user); session.SaveChanges(); succeeded = true; } } return succeeded; }