public async Task UpdateAsync(string id, UpdateCharacterRequest request) { await _writeRepository.UpdateAsync(id, request); var ownedDowntimes = await _downtimeReadRepository.GetAsync(d => d.Character.Id == id); foreach (var downtime in ownedDowntimes) { var downtimeUpdate = new UpdateDowntimeRequest { Costs = downtime.Costs .Select(c => new UpdateDowntimeCostRequest { ActivityCostKind = c.ActivityCostKind, Goal = c.Goal, Value = c.Value }) .ToArray(), SharedWith = request.SharedWith }; await _downtimeWriteRepository.UpdateAsync(downtime.Id, downtimeUpdate); } }
public async Task <DowntimeEntity[]> GetCurrentAsync() => await _readRepository.GetAsync(d => d.Costs.Any(c => c.Value < c.Goal));