Пример #1
0
        public IActionResult Detail(string parkCode, int?preference)
        {
            TempPreference temperaturePreference = GetTempPreference(preference);

            var park     = dal.GetParkDetails(parkCode);
            var forecast = dal.GetFiveDayForecast(parkCode);

            Tuple <Park, IList <Weather>, int> data = new Tuple <Park, IList <Weather>, int>(park, forecast, temperaturePreference.Preference);

            return(View(data));
        }
Пример #2
0
        private TempPreference GetTempPreference(int?preference)
        {
            TempPreference tempPreference = HttpContext.Session.Get <TempPreference>(Session_Key);

            if (tempPreference == null)
            {
                tempPreference            = new TempPreference();
                tempPreference.Preference = 1;
                HttpContext.Session.Set(Session_Key, tempPreference);
            }
            else
            {
                if (preference.HasValue)
                {
                    tempPreference.Preference = (int)preference;
                    HttpContext.Session.Set(Session_Key, tempPreference);
                }
            }
            return(tempPreference);
        }