public static DataVisualizationModel GetData() { if (cachedModel != null) { return(cachedModel); } DataVisualizationModel model = new DataVisualizationModel(); if (conn == null || conn.State != System.Data.ConnectionState.Open) { conn = DataAccessLayer.DataAccessLayer.OpenConnection(); cmd = new SqlCommand("", conn); } model.durationsBasedOnMonth = GetDurationsOnMonth(conn, cmd).ToArray(); model.passholderActivity = GetPassholderActivity(conn, cmd).ToArray(); model.passholderOverages = GetPassholderProfit(conn, cmd).ToArray(); model.endStationTraffic = GetStationEndActivity(conn, cmd).ToArray(); model.startStationTraffic = GetStationStartActivity(conn, cmd).ToArray(); model.averageDistTraveled = GetAverageDist(conn, cmd); model.regularRiders = GetRegulars(conn, cmd); model.hourlyActivity = GetHourlyActivity(conn, cmd).ToArray(); model.stationLocations = GetLocationData(conn, cmd).ToArray(); cachedModel = model; return(model); }
public IActionResult Index() { DataVisualizationModel model = DataController.GetData(); return(View(model)); }