Example #1
0
        public async Task <List <Charge> > GetOpenChildrenAsync(Charge charge)
        {
            var children = await _chargeService.GetChildrenAsync(charge);

            var completedStatus = await _statusService.GetCompletedStatusAsync(charge.BatteryId);

            return(children.Where(x => x.StatusId != completedStatus.Id).ToList());
        }
Example #2
0
        public async Task DeleteChildrenAsync(Charge charge)
        {
            var children = await _chargeService.GetChildrenAsync(charge);

            foreach (var child in children)
            {
                await DeleteChargeOnlyAsync(child);
            }
        }
Example #3
0
        public async Task <List <ChargeChildrenCount> > GetChildrenCountAsync(List <Charge> charges)
        {
            List <ChargeChildrenCount> chargeChildrenCounts = new();

            foreach (var charge in charges)
            {
                var children = await _chargeService.GetChildrenAsync(charge);

                ChargeChildrenCount chargeChildrenCount = new()
                {
                    ChargeId      = charge.Id,
                    ChildrenCount = children.Count
                };
                chargeChildrenCounts.Add(chargeChildrenCount);
            }

            return(chargeChildrenCounts);
        }
    }