Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }