Emmmanuel FIADUFE

Emmmanuel FIADUFE

  • 791
  • 1.1k
  • 53.7k

Bind Monthly Sales performance on Line Graph

Nov 20 2023 9:37 PM

Hello Team,

Help me bind  sales data to my line graph

// This is to get sales performance by Month on the Line Graph and the chart area
 
public JsonResult GetSalesPerformanceOnGraph()
        {         
            ASPNETMASTERPOSTEntities db = new ASPNETMASTERPOSTEntities();
            var previousYear = (DateTime.Now.Year - 1);
            var sales = db.tblSales.ToList();
            var salesByMonthAmount = (from a in sales
                                      where DateTime.Parse(a.OrderDate).Year > previousYear
                                      group a by DateTime.Parse(a.OrderDate).Month into g
                                      select g.Sum(c => c.TotalAmount)).ToArray();

            var salesMonths = (from a in sales
                               where DateTime.Parse(a.OrderDate).Year > 

                ).ToList();

            return Json(new , JsonRequestBehavior.AllowGet);
        }
 


Answers (2)