Closed Karthik2610 closed 6 years ago
There is a method for this
public abstract Task<IdentityResult> DeleteAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken));
but if you have linked tables outside of identity you'd have to manually clean those first.
Hi blowdart
Thanks. If we use DeleteAsync it will delete from DB. My requirement is 1) A person joins a company we create a user 2) He resigns and we make that user to be deactivate using (locking out) , report will use deleted user created item to be shown for admin. (PDF or excel). await _userManager.SetLockoutEndDateAsync(user, DateTime.MaxValue.AddYears(-1)); 3) The reason we lock is if he joins back we need to give back the same ID, so we did not delete 4) If he does not come back and there is a requirement that we need to give the same ID (Email and Username), so new user should not see old details which user 1 created 5) Now when i create _userManager.CreateAsync is not allowing me and says email and username already exist.
My question If we lock the user and if we create new user with email and user name of that locked user will it allow (please guide me) ? or we need to deleted the user and create new one.
You must delete. You cannot duplicate usernames they are designed to be unique.
Thanks
Hi I am deactivating the user with the following code await _userManager.SetLockoutEndDateAsync(user, DateTime.MaxValue.AddYears(-1)); now i need to create a new user with same credentials that locked out user has because that username and email will be given to new joined user. Please let me know if there is any other way Please guide me if we can do this.