I am doing the management of a user's account when necessary I can Lock a user's account in case they violate it. Or can be unlocked if required. I got an error like this. Where am I wrong, I use .Net Core 5 to build my program. Error: "An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object."
Interface
    public bool LockUser(string email);
    public bool UnlockUser(string email);
Repo
public bool LockUser(string email)
    {
        var userTask = _userManager.FindByEmailAsync(email);
        userTask.Wait();
        var user = userTask.Result;
        var lockUserTask = _userManager.SetLockoutEnabledAsync(user, true);
        lockUserTask.Wait();
        var lockDateTask = _userManager.SetLockoutEndDateAsync(user, DateTimeOffset.Now);
        lockDateTask.Wait();
        return lockDateTask.Result.Succeeded && lockUserTask.Result.Succeeded;
    }
Controller
public ActionResult LockUser(string email)
    {
        if (!_userRepository.LockUser(email))
        {
            throw new ArgumentException("Error");
        }
        return RedirectToAction("Index");
    }
 
     
    
