Fix context error

This commit is contained in:
2025-11-03 12:49:01 +09:00
parent 96d3a5530b
commit ae4d30d27b
2 changed files with 6 additions and 1 deletions

View File

@ -104,7 +104,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
campaign.Step = (int)Step.End; campaign.Step = (int)Step.End;
await HeadquartersService.UpdateCampaignStepAsync(context, campaign); await HeadquartersService.UpdateCampaignStepAsync(context, campaign);
await HeadquartersService.SetCampaignEndedAsync(campaign.Id); await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id);
await transaction.CommitAsync(); await transaction.CommitAsync();
} }

View File

@ -100,6 +100,11 @@ namespace Hcs.WebApp.Services
public async Task SetCampaignEndedAsync(int campaignId) public async Task SetCampaignEndedAsync(int campaignId)
{ {
using var context = GetNewContext(); using var context = GetNewContext();
await SetCampaignEndedAsync(context, campaignId);
}
public async Task SetCampaignEndedAsync(HcsDbContext context, int campaignId)
{
var campaign = await context.Campaigns.FirstOrDefaultAsync(x => x.Id == campaignId); var campaign = await context.Campaigns.FirstOrDefaultAsync(x => x.Id == campaignId);
if (campaign != null) if (campaign != null)
{ {