Exemplo n.º 1
0
        private async Task <List <ChartData> > GetChartData(ResourceListResult resourceList, string subscriptionId)
        {
            if (!resourceList.Resources.Any())
            {
                return(new List <ChartData>());
            }

            var rateCard = rateCardRepository.GetRateCardData(subscriptionId);

            var resourceUsageData = await billingRepository.GetBillingDataForLast30Days(resourceList, subscriptionId, DataAggregationType.DailyAggregationByResource);

            var resourceUsageDataToday = await billingRepository.GetBillingDataForToday(resourceList, subscriptionId, DataAggregationType.DailyAggregationByResource);

            return(CalculateCostsForChart(resourceUsageData, resourceUsageDataToday, rateCard.Result));
        }