public async Task <IActionResult> IndexAsync() { List <DateTime> months = this.GetFirstOfAllSolarMonth(); string ChartData = "["; for (int i = 0; i < months.Count - 1; i++) { double sum = 0; var transactions = await sponsors.GetFromToTransactionAsync(months[i], months[i + 1]); sum = transactions .Select(x => (x.MyTransaction?.Amount ?? 0) + (x.MyReceipt?.Amount ?? 0)) .Sum(); ChartData += sum.ToString(); ChartData += ", "; } ChartData = ChartData.Substring(0, ChartData.Length - 1) + "]"; ViewBag.ChartData = ChartData; ViewBag.ColleaguesCount = colleagues.Count(); ViewBag.SponsorsCount = sponsors.Count(); return(View()); }