Esempio n. 1
0
        public async Task <IActionResult> ShowChart()
        {
            var currentForecast = await _weatherService.GetCurrentForecast();

            var current = JsonConvert.SerializeObject(currentForecast["current"]);
            var daily   = JsonConvert.SerializeObject(currentForecast["daily"]);

            _context.Forecasts.AsQueryable <Forecast>().AddOrUpdateByCityName(_context, current, daily);

            var historicalForecast = await _weatherService.GetHistoricalForecast();

            var intervalForecast = await _weatherService.GetIntervalForecast(historicalForecast);

            var model = _faultService.CalculateFaults(historicalForecast, intervalForecast);

            return(View("ShowChart", model));
        }