confusion arise from the fact that we create the UserManger in one line like this:
var currentUserId = new UserManager<applicationuser>(new UserStore<applicationuser>(new MyDbContext()));</applicationuser></applicationuser>
then we use currentUserId .UpdateAsync( user ); but that will update the user in the context and then we will need to savechanges to the dbcontext of the Identity.. so the question is how to get the Identity DBcontext in the easiest way !!??
and to solve this we should not create the UserManger in one line ... and here is how I do it:
var store = new UserStore<ApplicationUser>(new MyDbContext());
var currentUserId = new UserManager(store);
then after updating the user by calling currentUserId.UpdateAsync(user);
you go to the context as follow:
var ctx = store.context;
then
ctx.saveChanges();