private async Task DeleteAllChargesAndRelatedItemsAsync(Battery battery) { var charges = await _chargeService.GetAsync(battery); foreach (var charge in charges) { await _deleteChargeController.DeleteChargeAndAllRelatedItemsAsync(charge); } }
public async Task <int> GetActiveCountAsync(Battery battery) { var charges = await _chargeService.GetAsync(battery); return(charges.Where(x => x.BatteryId == battery.Id && (x.Completed is null || x.Completed >= DateTime.UtcNow.AddDays(-3))).ToList().Count); }