public void Update(User user, string password = null) { var existingUser = _context.Users.Find(user.Id); _context.Attach(user).State = EntityState.Modified; _context.Users.Update(user); _context.SaveChanges(); }
public virtual async Task <bool> RemoveAsync <T>(T item, CancellationToken token = default) where T : class, ISqlEntry { await _semaphore.WaitAsync(token); try { _context.Attach(item).State = EntityState.Deleted; return(await _context.SaveChangesAsync(token) == 1); } finally { _semaphore.Release(); } }