コード例 #1
0
        public IActionResult Details(string parkCode)
        {
            ParkViewModel parkSp = new ParkViewModel();

            //parkSp.ParkCode = parkCode;
            parkSp.Park    = _parkDAO.GetPark(parkCode);
            parkSp.Weather = _weatherDAO.GetWeather(parkCode);

            return(GetAuthenticatedView("Details", parkSp));
        }
コード例 #2
0
        public IActionResult ParkDescription(string id, string temppref)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (temppref == null)
            {
                temppref = HttpContext.Session.GetString("temppref");
                if (temppref == null)
                {
                    temppref = "f";
                }
            }
            else
            {
                HttpContext.Session.SetString("temppref", temppref);
            }
            ViewData["temppref"] = temppref;


            Park park = parkDAO.GetPark(id);

            park.Weather = weatherDAO.GetWeather(park.ParkCode);

            return(View(park));
        }
コード例 #3
0
        public IActionResult Detail(string parkCode, ParkWeatherVM vm) //add temptype as a parameter
        {
            // Get the details of the specific park and pass it into the view model.
            vm.Park = parkDAO.GetParkByCode(parkCode);

            //Get the weather for that particular park and pass it into the view model.
            IList <Weather> weather = weatherDAO.GetWeather(parkCode);

            //Seperate today's forecast from the rest of the days and then order the rest of the list.
            weather    = vm.GetTodaysForecast(weather);
            vm.Weather = weather.OrderBy(w => w.FiveDayForecastValue).ToList();

            //session will be GET in here, probably put it in to view model

            if (HttpContext.Session.GetString("temperature") == null || HttpContext.Session.GetString("temperature") == "F")
            {
                vm.TempType = "F";
            }
            else
            {
                vm.TempType = HttpContext.Session.GetString("temperature");
                foreach (Weather w in weather)
                {
                    vm.Today.Low  = (int)w.ConvertTemp("C", w.Low);
                    vm.Today.High = (int)w.ConvertTemp("C", w.High);
                    w.Low         = (int)w.ConvertTemp("C", w.Low);
                    w.High        = (int)w.ConvertTemp("C", w.High);
                }
            }

            return(View(vm));
        }
        // Detail Page for selected park
        public IActionResult Detail(string parkCode)
        {
            WeatherVM vm = new WeatherVM();

            vm.Park     = nationalParkDAO.GetPark(parkCode);
            vm.Weathers = weatherDAO.GetWeather(parkCode);
            return(View(vm));
        }
コード例 #5
0
        public IActionResult GetPark(string parkCode)
        {
            ParkDetailVM vm = new ParkDetailVM();

            vm.Park        = parkDAO.GetPark(parkCode);
            vm.Weather     = weatherDAO.GetWeather(parkCode);
            vm.Temperature = GetPreferredTemp();
            return(View(vm));
        }
コード例 #6
0
        public IActionResult GetPark(string parkCode)
        {
            //if user clicks on a park - calls GET and returns a lists park details
            ParkDetailVM vm = new ParkDetailVM();

            vm.Park        = parkDAO.GetPark(parkCode);
            vm.Weather     = weatherDAO.GetWeather(parkCode);
            vm.Temperature = GetPreferredTemp();
            return(View(vm));
        }
コード例 #7
0
        public IActionResult Detail(string id)
        {
            ParkDetails currentDetails = new ParkDetails();

            currentDetails.IsCelsius = AccessTemperatureDetails();
            //uses the id from the park page that the user selected to get info on the specific park, putting it into a list with only one index.
            IList <Park> SingleParkList = parkDAO.GetSelectedPark(id);
            Park         SelectedPark   = new Park();

            //gets the park out of the list and assigns it to a single park.
            SelectedPark = SingleParkList[0];
            //takes the single park and assigns it to the parkdetails object to be passed to the detail page
            currentDetails.DetailPark        = SelectedPark;
            currentDetails.FahrenheitWeather = weatherDAO.GetWeather(id);
            currentDetails.AllWeather        = weatherDAO.GetWeather(id);
            if (currentDetails.IsCelsius == true)
            {
                currentDetails.AllWeather = currentDetails.ConvertTemp(currentDetails.AllWeather, currentDetails.IsCelsius);
            }
            return(View(currentDetails));
        }
        public IActionResult Detail(string id, ParkWeatherVM vm)
        {
            vm.TempChoice = HttpContext.Session.GetString("temp");
            if (vm.TempChoice == null)
            {
                vm.TempChoice = "Fahrenheit";
            }


            vm.park        = parksDAO.GetPark(id);
            vm.weather     = weatherDAO.GetWeather(id);
            vm.weatherDays = weatherDAO.GetWeatherDays(id);
            return(View(vm));
        }
        public IActionResult Detail(string parkCode)  // Show Park Detail (includes weather)
        {
            ParkDetailVM parkVM = new ParkDetailVM();

            parkVM.TempUnit = HttpContext.Session.GetString("tempUnit");
            if (parkVM.TempUnit == null)
            {
                parkVM.TempUnit = "F";
                HttpContext.Session.SetString("tempUnit", parkVM.TempUnit);
            }
            parkVM.Park    = parkDAO.GetParkDetails(parkCode);
            parkVM.Weather = weatherDAO.GetWeather(parkCode, parkVM.TempUnit);
            return(View(parkVM));
        }
コード例 #10
0
        public IActionResult Detail(string id, int temp)
        {
            ViewBag.Forecast = HttpContext.Session.GetInt32("Forecast");

            if (ViewBag.Forecast == null || ViewBag.Forecast == 0)
            {
                HttpContext.Session.SetInt32("Forecast", 1);
            }
            if (temp != 0)
            {
                HttpContext.Session.SetInt32("Forecast", temp);
            }

            ViewBag.Forecast = HttpContext.Session.GetInt32("Forecast");
            IList <Weather> forecast = weatherDAO.GetWeather(id);

            return(View(forecast));
        }