I have created a Delete action method and an action button in the view, but i keep getting errors. Could someone take a look at the code and tell me what's wrong?
  public async Task<IActionResult> DeleteUserd(string Id)
    {
       //get User Data from Userid
        var user = await _usermanager.FindByIdAsync(Id);
        //List Logins associated with user
        var logins = user;
        //Gets list of Roles associated with current user
        var rolesForUser = await _usermanager.GetRolesAsync(user);
        using (var transaction = _application.Database.BeginTransaction())
        {
            if (rolesForUser.Count() > 0)
            {
                foreach (var item in rolesForUser.ToList())
                {
                    // item should be the name of the role
                    var result = await _usermanager.RemoveFromRoleAsync(user, item);
                }
            }
            //Delete User
            await _usermanager.DeleteAsync(user);
            TempData["Message"] = "User Deleted Successfully. ";
            TempData["MessageValue"] = "1";
            //transaction.commit();
        }
        return RedirectToAction("UsersWithRoles", "ManageUsers"); 
    }
Here is the view button:
 <a asp-action="DeleteUserd">Delete</a>
    
Idis probably null... The mangled code in the exception is an unfortunate side-effect of all the work the compiler does to implementawait...