Load initiated operations
This commit is contained in:
@ -26,5 +26,25 @@ namespace Hcs.WebApp.Services
|
||||
await context.SaveChangesAsync();
|
||||
return operation;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Operation>> GetInitiatedOperations()
|
||||
{
|
||||
using var context = factory.CreateDbContext();
|
||||
return await (from operation in context.Operations
|
||||
where !operation.EndedAt.HasValue && string.IsNullOrEmpty(operation.MessageGuid)
|
||||
select operation).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task SetOperationMessageGuid(int operationId, string messageGuid)
|
||||
{
|
||||
using var context = factory.CreateDbContext();
|
||||
var operation = await context.Operations.FirstOrDefaultAsync(x => x.Id == operationId);
|
||||
if (operation != null)
|
||||
{
|
||||
operation.MessageGuid = messageGuid;
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user