Automated Task

开始

Type Scheduled

Date Executed 7/19/2024, 9:00:00 AM

Created 7/17/2024, 3:44:13 PM

Updated 7/17/2024, 3:44:13 PM

Description 启动赛道。

Code
1
using Microsoft.Extensions.Logging;
2
using Microsoft.Extensions.DependencyInjection;
3
using PhiZoneApi.Models;
4
using PhiZoneApi.Enums;
5
using PhiZoneApi.Interfaces;
6

7
var target = (EventDivision)Target;
8
await using (var scope = ServiceProvider.CreateAsyncScope())
9
{
10
    var eventDivisionRepository = scope.ServiceProvider.GetRequiredService<IEventDivisionRepository>();
11
    target.Status = EventDivisionStatus.Started;
12
    await eventDivisionRepository.UpdateEventDivisionAsync(target);
13
}