public IQueryable <User> GetBumpedAccountsByCipherId(Cipher cipher) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = new UserBumpAccountRevisionDateByCipherIdQuery(cipher); return(query.Run(dbContext)); } }
protected async Task UserBumpAccountRevisionDateByCipherId(IEnumerable <Cipher> ciphers) { using (var scope = ServiceScopeFactory.CreateScope()) { foreach (var cipher in ciphers) { var dbContext = GetDatabaseContext(scope); var query = new UserBumpAccountRevisionDateByCipherIdQuery(cipher); var users = query.Run(dbContext); await users.ForEachAsync(e => { dbContext.Attach(e); e.RevisionDate = DateTime.UtcNow; }); await dbContext.SaveChangesAsync(); } } }