public JsonResult OnGetInvoiceChartDataSync() { InvoiceList = _invoiceService.GetInvoices(); var invoiceChart = new CategoryChartModel(); invoiceChart.AmountList = new List <double>(); invoiceChart.CategoryList = new List <string>(); foreach (var inv in InvoiceList) { invoiceChart.AmountList.Add(inv.Amount); invoiceChart.CategoryList.Add(inv.CostCategory); } return(new JsonResult(invoiceChart)); }
public async Task <JsonResult> OnGetInvoiceAsyncChartData() { InvoiceModel = await _context.InvoiceModel.ToListAsync(); var invoiceChart = new CategoryChartModel(); invoiceChart.AmountList = new List <double>(); invoiceChart.CategoryList = new List <string>(); foreach (var inv in InvoiceModel) { invoiceChart.AmountList.Add(inv.Amount); invoiceChart.CategoryList.Add(inv.CostCategory); } return(new JsonResult(invoiceChart)); }