mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-19 13:14:21 +01:00
Warning if not using 'simple using'
This commit is contained in:
@@ -28,19 +28,17 @@ namespace BTCPayServer.Security.Greenfield
|
||||
|
||||
public async Task<List<APIKeyData>> GetKeys(APIKeyQuery query)
|
||||
{
|
||||
using (var context = _applicationDbContextFactory.CreateContext())
|
||||
using var context = _applicationDbContextFactory.CreateContext();
|
||||
var queryable = context.ApiKeys.AsQueryable();
|
||||
if (query != null)
|
||||
{
|
||||
var queryable = context.ApiKeys.AsQueryable();
|
||||
if (query != null)
|
||||
if (query.UserId != null && query.UserId.Any())
|
||||
{
|
||||
if (query.UserId != null && query.UserId.Any())
|
||||
{
|
||||
queryable = queryable.Where(data => query.UserId.Contains(data.UserId));
|
||||
}
|
||||
queryable = queryable.Where(data => query.UserId.Contains(data.UserId));
|
||||
}
|
||||
|
||||
return await queryable.ToListAsync();
|
||||
}
|
||||
|
||||
return await queryable.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task CreateKey(APIKeyData key)
|
||||
@@ -50,11 +48,9 @@ namespace BTCPayServer.Security.Greenfield
|
||||
throw new InvalidOperationException("cannot save a bitpay legacy api key with this repository");
|
||||
}
|
||||
|
||||
using (var context = _applicationDbContextFactory.CreateContext())
|
||||
{
|
||||
await context.ApiKeys.AddAsync(key);
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
using var context = _applicationDbContextFactory.CreateContext();
|
||||
await context.ApiKeys.AddAsync(key);
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> Remove(string id, string getUserId)
|
||||
|
||||
Reference in New Issue
Block a user