protected override async Task AddCoreAsync(Shift shift, EventHandlingContext context)
{
shift.Created = timeProvider.GetUtcNow().DateTime;
dbContext.Shifts.Add(shift);
dbContext.ShiftQualifications.AddRange(shift.Qualifications!);
await dbContext.SaveChangesAsync(context.CancellationToken).ConfigureAwait(false);
}
public override async Task<Shift?> FindCoreAsync(Shift shift, EventHandlingContext context)
{
var foundShift = await dbContext.Shifts
.AsNoTracking()
.FirstOrDefaultAsync(
s => s.ScheduledStart == shift.ScheduledStart
&& s.Type == shift.Type
&& s.ResourceId == shift.ResourceId,
context.CancellationToken)
.ConfigureAwait(false);
return foundShift;
}
protected override async Task AddCoreAsync(Shift shift, EventHandlingContext context)
{
shift.Created = timeProvider.GetUtcNow().DateTime;
dbContext.Shifts.Add(shift);
dbContext.ShiftQualifications.AddRange(shift.Qualifications!);
await dbContext.SaveChangesAsync(context.CancellationToken).ConfigureAwait(false);
}
public override async Task<Shift?> FindCoreAsync(Shift shift, EventHandlingContext context)
{
var foundShift = await dbContext.Shifts
.AsNoTracking()
.FirstOrDefaultAsync(
s => s.ScheduledStart == shift.ScheduledStart
&& s.Type == shift.Type
&& s.ResourceId == shift.ResourceId,
context.CancellationToken)
.ConfigureAwait(false);
return foundShift;
}