Esempio n. 1
0
        async Task SaveForecast()
        {
            ShowPopup = false;
            var user = (await authenticationStateTask).User;

            if (objWeatherForecast.Id == 0)
            {
                WeatherForecast objNewWeatherForecast = new WeatherForecast();
                objNewWeatherForecast.Date         = System.DateTime.Now;
                objNewWeatherForecast.Summary      = objWeatherForecast.Summary;
                objNewWeatherForecast.TemperatureC =
                    Convert.ToInt32(objWeatherForecast.TemperatureC);
                objNewWeatherForecast.TemperatureF =
                    Convert.ToInt32(objWeatherForecast.TemperatureF);
                objNewWeatherForecast.UserName = user.Identity.Name;
                var result =
                    ForecastService.CreateForecastAsync(objNewWeatherForecast);
            }
            else
            {
                var result =
                    ForecastService.UpdateForecastAsync(objWeatherForecast);
            }
            forecasts =
                await ForecastService.GetForecastAsync(user.Identity.Name);
        }