public async Task <IdentityResult> UpdateAsync(ApplicationUser user, CancellationToken cancellationToken) { try { var trackedUser = await _context.Users.FindAsync(user.Id, cancellationToken); trackedUser.Email = user.Email; trackedUser.PasswordHash = user.PasswordHash; trackedUser.UserName = user.UserName; _context.Entry(trackedUser).State = EntityState.Modified; await _context.SaveChangesAsync(cancellationToken); return(IdentityResult.Success); } catch { return(IdentityResult.Failed()); } }
public void Update(TEntity entity) { var entityEntry = _context.Entry(entity); entityEntry.State = EntityState.Modified; }