Пример #1
0
        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));
        }
Пример #2
0
        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);
        }