How to give custom implementation of UpdateAsync method of asp.net identity?

Not sure if this is what your looking for…

public Task UpdateAsync(UserModel model)
{
    var user = _dbContext.User.Find(x => x.id == model.id);
    user.Password = model.Password;
    _dbContext.SaveChanges();
    return Task.CompletedTask;
}

It Will get the specific record and Update the password and then save the record.

Edit

Since the password is not getting encrypted i added code to take that string and leave the model as it is, this extension method will encrypt the value of password, i have not test this but i am sure it will work.

 user.Password = model.Password.EncryptPassword(EncryptKey);

Extension methods to encrypt password

Leave a Comment