public Task Add(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token) { var record = caseWorkerTask.ToModel(); _caseManagementDbContext.CaseWorkers.Add(record); return(Task.CompletedTask); }
public async Task Update(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token) { using (var lck = await _caseManagementDbContext.Lock()) { var record = await _caseManagementDbContext.CaseWorkers.FirstOrDefaultAsync(_ => _.Id == caseWorkerTask.AggregateId, token); if (record == null) { return; } _caseManagementDbContext.CaseWorkers.Remove(record); _caseManagementDbContext.CaseWorkers.Add(caseWorkerTask.ToModel()); } }