public async Task <User> SignUp(User user, string password) { if (string.IsNullOrEmpty(password) || user == null) { return(null); } else { bool userExists = await _dataContext.Users. AnyAsync(account => account.Email == user.Email); if (!userExists) { user.PasswordSalt = ComputeSalt(); user.PasswordHash = ComputeHash(password, user.PasswordSalt); await _dataContext.AddAsync(user); await _dataContext.SaveChangesAsync(); return(user); } else { return(null); } } }