public ActionResult GetChartData() { List <test> data = new List <test>(); //Here MyDatabaseEntities is our dbContext using (kappaEntities dc = new kappaEntities()) { data = dc.test.ToList(); } var dt = new VisualizationDataTable(); dt.AddColumn("Time", "string"); dt.AddColumn("Pressure", "number"); foreach (var item in data) { dt.NewRow(item.Time, item.Pressure); } var chart = new ChartViewModel { Title = "Events", Subtitle = "per date", DataTable = dt }; return(Content(JsonConvert.SerializeObject(chart), "application/json")); }
public ActionResult Contact() { List <test> result = new List <test>(); using (kappaEntities db = new kappaEntities()) { result = (from s in db.test select s).ToList(); return(View(result)); } }