public IHttpActionResult GetDashboardCharts() { string token = Request.Headers.GetValues("Authorization").First(); ApplicationUser user = UserManager.GetUserByToken(token); if (user == null) { return(BadRequest("Security access token not found in user database.")); } List <Chart> userCharts = new List <Chart>(); foreach (Chart c in user.Dashboard) { ChartManager.RetrieveDataChart(c); userCharts.Add(c); } List <SimpleChart> charts = new List <SimpleChart>(); foreach (Chart c in userCharts) { SimpleChart sc = new SimpleChart { Name = "Grafiek", Type = c.ChartType, Data = c.ChartItemData }; charts.Add(sc); } return(Ok(charts)); }
public IHttpActionResult GetHomeCharts() { List <SimpleChart> charts = new List <SimpleChart>(); foreach (KeyValuePair <string, Chart> entry in ChartManager.GetStandardChart()) { SimpleChart sc = new SimpleChart { Name = entry.Key, Type = entry.Value.ChartType, Data = entry.Value.ChartItemData }; charts.Add(sc); } return(Ok(charts)); }