public AccountModel SignIn(AccountModel account) { var registeredAccount = _accountService.Exists(account); return(registeredAccount != null && BCryptPasswordEncoder.Validate(account.PasswordHash, registeredAccount.PasswordHash) ? registeredAccount : null); }
public bool SignUp(CompositeModel model) { try { model.Account.PasswordHash = BCryptPasswordEncoder.Hash(model.Account.PasswordHash); var user = _userService.Save(model.User); model.Account.User.Id = user.Id; var role = _roleService.Save(model.Role); model.Account.Role.Id = role.Id; _accountService.Save(model.Account); } catch { return(false); } return(true); }