コード例 #1
0
        public ActionResult Detail(string parkCode)
        {
            if (Session["isCelsius"] == null)
            {
                Session["isCelsius"] = false;
            }

            if (parkCode == "" || parkCode == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else if (parkDAL.GetPark(parkCode) == null)
            {
                return(RedirectToAction("PageNotFound", "Home"));
                //return httpnotfound(); <--this will return the 404 page
                //This allows you to set the web config to direct them to a different URL (look at exception not found website)
            }

            Park model = parkDAL.GetPark(parkCode);

            model.Forecast = parkDAL.GetFiveDayForecast(parkCode);
            model.SwitchDegrees(Convert.ToBoolean(Session["isCelsius"]));

            return(View("Detail", model));
        }
コード例 #2
0
        public ActionResult Index()
        {
            int  yosemiteId = 1;
            Park model      = parkDAL.GetPark(yosemiteId);

            model.Campgrounds = campgroundDAL.GetCampgroundsForPark(yosemiteId);
            return(View("Index", model));
        }
コード例 #3
0
        public ActionResult Detail(string parkCode)
        {
            DetailViewModel p = new DetailViewModel()
            {
                Park = parkDAL.GetPark(parkCode),
                FiveDaysOfWeather = weatherDAL.GetForecast(parkCode),
                IsFahrenheit      = true
            };

            return(View("Detail", p));
        }
コード例 #4
0
        public ActionResult ParkDetail(string id)
        {
            List <ForecastModel> forecast = forcastDal.GetForecast(id);
            ParkModel            park     = parkDal.GetPark(id);
            WeatherViewModel     weather  = new WeatherViewModel()
            {
                Park     = park,
                Forecast = forecast
            };

            return(View("ParkDetail", weather));
        }
コード例 #5
0
ファイル: ParkController.cs プロジェクト: junakhatri1/NPGeek
        public ActionResult Detail(string parkCode)
        {
            string tempScale = GetTempScale();
            Park   park      = parkDal.GetPark(parkCode);

            if (park == null)
            {
                return(HttpNotFound());
            }
            park.TempScale = tempScale;
            return(View("Detail", park));
        }
コード例 #6
0
        public IActionResult Detail(string parkCode)
        {
            Park            park    = parkDal.GetPark(parkCode);
            IList <Weather> weather = weatherDal.GetWeatherByPark(parkCode);

            //send in a temperature scale?
            //get tempScale (default or via SetTempScale)
            //I feel like I'm not actually using the session b/c I'm saving it as a value in the model.
            string tempScale = HttpContext.Session.GetString("tempScale");

            //if not set yet
            if (tempScale == null)
            {
                tempScale = "F";
                HttpContext.Session.SetString("tempScale", tempScale); //this defaults the weather to Fahrenheit scale (could base on location?)
            }
            //if set to fahrenheit **FROM** celcius
            else if (tempScale == "tempF")
            {
                tempScale = "F"; //set tempscale to F (for detail page weather report) if fahrenheit is chosen by button
            }
            //if set to celcius from fahrenheit
            else
            {
                tempScale = "C"; //set tempscale to C (for detail page weather report) if fahrenheit is chosen by button
            }

            DetailViewModel dvm = new DetailViewModel(park, weather);

            dvm.TempScale = tempScale; //load the detailViewModel with our tempscale.
            return(View(dvm));
        }
コード例 #7
0
        public IActionResult Detail(string parkCode)
        {
            var park = dal.GetPark(parkCode);

            park.Forecast = wdal.FiveDayForecast(parkCode);
            string pref = HttpContext.Session.GetString(Session_Key);

            switch (pref)
            {
            case null:
                pref = "f";
                HttpContext.Session.SetString(Session_Key, pref);
                break;

            case "c":
                HttpContext.Session.SetString(Session_Key, pref);
                break;

            case "f":
                HttpContext.Session.SetString(Session_Key, pref);
                break;

            default:
                break;
            }

            park.UserPreference = pref;
            return(View(park));
        }
コード例 #8
0
        public IActionResult Detail(string id)
        {
            var park = parkDAL.GetPark(id);

            ViewBag.Forecast = forecastDAL.GetForecastForPark(id);

            return(View(park));
        }
コード例 #9
0
        public void whenGetParkIsRunCodeIsCVNP()
        {
            Park park = new Park();

            park = _parkDAL.GetPark("CVNP");

            Assert.AreEqual("CVNP", park.Code);
        }
コード例 #10
0
        // GET: Park
        public ActionResult Detail(string id)
        {
            Park           p  = dal.GetPark(id);
            List <Weather> w  = dal.GetWeather(id);
            PW             pw = new PW(p, w);

            return(View("Detail", pw));
        }
コード例 #11
0
 public ActionResult Detail(string id)
 {
     {
         ParkModel park = dal.GetPark(id);
         park.Weather = dal.GetWeather(id);
         return(View("Detail", park));
     }
 }
コード例 #12
0
        public async Task <IActionResult> ParkDetail(string code)
        {
            ParkModel park = parkDAL.GetPark(code);

            ViewData["weathers"] = await parkDAL.GinerateWeathers(code);

            ViewData["settings"] = GetUserSettings();
            return(View(park));
        }
コード例 #13
0
        public ActionResult ParkDetail(string id)
        {
            ParksModel model = dal.GetPark(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View("ParkDetail", model));
        }
コード例 #14
0
        public ActionResult ParkDetail(string parkCode)
        {
            if (parkCode.Equals(null))
            {
                return(Index());
            }

            var park = _dal.GetPark(parkCode);

            return(View("ParkDetail", park));
        }
コード例 #15
0
        //Get: Deatil Page <--one park by the park code/id
        public ActionResult Detail(string parkID)
        {
            Park p = new Park();

            Park ps = new Park();

            p              = dal.GetPark(parkID);
            p.weather      = dal.Weather(parkID);
            p.IsFahrenheit = true;
            return(View("Detail", p));
        }
コード例 #16
0
        public IActionResult Detail(string id)
        {
            var park = pdal.GetPark(id);
            //Get weather results for said park
            var weather = wdal.GetWeatherForPark(id);
            var model   = new ParkDetailModel()
            {
                Park        = park,
                ParkWeather = weather
            };

            return(View(model));
        }
コード例 #17
0
        public IActionResult Detail(string id)
        {
            ParkModel model = _parkDAL.GetPark(id);

            model.Weather = _weatherDAL.GetWeatherByPark(id);
            model.TemperatureScaleModel = new TemperatureScaleModel();

            if (HttpContext.Session.Get <TemperatureScaleModel>("TemperatureType") != null)
            {
                model.TemperatureScaleModel.TemperatureScale = HttpContext.Session.Get <TemperatureScaleModel>("TemperatureType").TemperatureScale.ToString();
            }

            return(View(model));
        }
コード例 #18
0
ファイル: SurveyController.cs プロジェクト: xriskarap/NPGeek
        public IActionResult Index()
        {
            Dictionary <string, int> surveyCount = surveyDAL.GetSurveyPosts();
            IList <SurveyPark>       surveyParks = new List <SurveyPark>();

            foreach (KeyValuePair <string, int> kvp in surveyCount)
            {
                var        parkCount  = parkDAL.GetPark(kvp.Key);
                SurveyPark surveyList = new SurveyPark();
                surveyList.surveyPark = parkCount;
                surveyList.Count      = kvp.Value;
                surveyParks.Add(surveyList);
            }
            return(View(surveyParks));
        }
コード例 #19
0
        public ActionResult View(string parkCode)
        {
            ParkModel park = parkDAL.GetPark(parkCode);

            if (park == null)
            {
                return(HttpNotFound());
            }

            List <DailyWeatherModel>  fiveDayForecast = weatherDAL.GetParkWeather(parkCode);
            ParkDailyWeatherViewModel parkWeather     = new ParkDailyWeatherViewModel()
            {
                Park            = park,
                FiveDayForecast = fiveDayForecast
            };

            return(View("View", parkWeather));
        }
コード例 #20
0
        public IActionResult Detail(string code)
        {
            DetailViewModel park = new DetailViewModel();

            park.Park    = _parkDAL.GetPark(code);
            park.Weather = _weatherDAL.GetWeather(code);

            park.ForecastRecommendation    = _weatherDAL.CreateForecastRecommendation(park.Weather[0].Forecast);
            park.TemperatureRecommendation = _weatherDAL.CreateTemperatureRecommendation(park.Weather[0].LowTemp, park.Weather[0].HighTemp);

            if (HttpContext.Session.Get <string>("UnitOfTemp") == "celsius")
            {
                foreach (Weather weather in park.Weather)
                {
                    weather.ConvertTemp();
                }
            }

            return(View(park));
        }
コード例 #21
0
ファイル: HomeController.cs プロジェクト: xriskarap/NPGeek
        public IActionResult Detail(string id)
        {
            DetailView detailView = new DetailView();
            var        park       = dal.GetPark(id);
            var        degree     = GetCurrentDegree();

            detailView.Park = park;
            var currentWeather = weatherDal.GetForecast(id);

            if (degree == "C")
            {
                foreach (var weather in currentWeather)
                {
                    weather.Degree = "C";
                    weather.High   = weather.ConvertToCelsius(weather.High);
                    weather.Low    = weather.ConvertToCelsius(weather.Low);
                }
            }
            detailView.fiveDay = currentWeather;
            return(View(detailView));
        }
コード例 #22
0
        public IActionResult Detail(string parkCode)
        {
            Park park = parkDAL.GetPark(parkCode);

            List <Weather> weather = new List <Weather>();
            string         TempKey = HttpContext.Session.GetString("SessionTemperatureKey");

            if (TempKey == "Fahrenheit")
            {
                weather = weatherDAL.GetWeather(parkCode);
            }
            else
            {
                weather = weatherDAL.GetWeatherCelsius(parkCode);
            }

            Detail detailObject = new Detail();

            detailObject.park    = park;
            detailObject.weather = weather;
            return(View(detailObject));
        }
コード例 #23
0
        /// <summary>
        /// Detail View of Parks with 5 Day weather forecast
        /// </summary>
        /// <param name="id">Park.ParkCode to GET that park upon Click()</param>
        /// <returns>Detail View</returns>
        public ActionResult Detail(string id)
        {
            // If no park was clicked then return to index page
            if (id == null)
            {
                return(RedirectToAction("Index", "Park"));
            }

            //Gets current Temp unit to work with in View
            string tempUnit = GetCurrentTempUnit();

            //Get park by param: id
            Park           park    = _parkDAL.GetPark(id);
            List <Weather> weather = _weatherDAL.GetWeatherByParkCode(id);
            ParkWeather    pw      = new ParkWeather()
            {
                Park     = park,
                Weather  = weather,
                TempUnit = tempUnit
            };

            return(View("Detail", pw));
        }
コード例 #24
0
        public ActionResult Detail(string parkCode)
        {
            NationalParkModel model = parkDAL.GetPark(parkCode);

            return(View("Detail", model));
        }
コード例 #25
0
        // GET: Park/Detail
        public ActionResult Detail(string id)
        {
            Park park = _parkDal.GetPark(id);

            return View("ParkDetails", park);
        }
コード例 #26
0
        public ActionResult Detail(string parkCode)
        {
            ParkModel model = dal.GetPark(parkCode);

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