public async Task <DashboardShortViewModel> GetShortsDashboardById(string id) { string path = "./dashboards.json"; DashboardShortJson dashboards = new DashboardShortJson(); using (StreamReader reader = new StreamReader(path)) { var dashboardJson = await reader.ReadToEndAsync(); dashboards = JsonConvert.DeserializeObject <DashboardShortJson>(dashboardJson); } return(dashboards?.dashboards?.Dashboard?.FirstOrDefault(x => x.Id == id)); }
public async Task <DashboardShortJson> GetAllShortsDashboards() { string path = "./dashboards.json"; DashboardShortJson dashboards = new DashboardShortJson(); using (StreamReader reader = new StreamReader(path)) { var dashboardJson = await reader.ReadToEndAsync(); dashboards = JsonConvert.DeserializeObject <DashboardShortJson>(dashboardJson); } return(dashboards); }