예제 #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 void ParkInformationTest()
        {
            //Adds and verifies new park has been added to list
            int parkCount = _dao.GetParkList().Count;

            AddPark();
            int newParkCount = _dao.GetParkList().Count;

            Assert.AreEqual(parkCount + 1, newParkCount);

            //Tests that the park information was pulled correctly for
            //the chosen park
            string parkCode = "TE";
            var    testPark = _dao.GetPark(parkCode);

            Assert.AreEqual("Tech Elevator", testPark.ParkName);
            Assert.AreEqual("Ohio", testPark.State);
            Assert.AreEqual(1, testPark.Acreage);
            Assert.AreEqual(30, testPark.ElevationInFeet);
            Assert.AreEqual(1, testPark.MilesOfTrail);
            Assert.AreEqual(2, testPark.NumberOfCampsites);
            Assert.AreEqual(2019, testPark.YearFounded);
            Assert.AreEqual(30, testPark.AnnualVisitors);
            Assert.AreEqual("Do what you want", testPark.InspirationalQuote);
            Assert.AreEqual("Chris Rupp", testPark.QuoteSource);
            Assert.AreEqual("Elevate yourself", testPark.ParkDescription);
            Assert.AreEqual(15500, testPark.EntryFee);
            Assert.AreEqual(1, testPark.NumberOfAnimalSpecies);

            //Adds fake weather to the park and tests how many days
            //of forecast were returned
            AddWeatherForecast();
            Assert.AreEqual(1, _dao.GetWeatherForecast(parkCode).Count);
        }
예제 #3
0
        public IActionResult Detail(string parkCode)
        {
            ParkViewModel vm = new ParkViewModel();

            vm.Park            = _db.GetPark(parkCode);
            vm.FiveDayForeCast = _db.GetFiveDayWeather(parkCode);
            return(GetAuthenticatedView("Detail", vm));
        }
예제 #4
0
        public IActionResult Detail(string code)
        {
            ParkViewModel parks = new ParkViewModel();

            parks.Park    = _dao.GetPark(code);
            parks.Weather = _dao.GetWeatherForecast(code);

            return(GetAuthenticatedView("Detail", parks));
        }
예제 #5
0
        public IActionResult Detail(string parkCode)
        {
            DetailViewModel vm = new DetailViewModel();

            vm.Park     = _dao.GetPark(parkCode);
            vm.Forecast = _dao.GetWeathers(parkCode);

            if (GetSessionData <bool>(UseCelciusKey))
            {
                vm.PrefersFarenheit = false;
            }

            return(GetAuthenticatedView("Detail", vm));
        }
        public IActionResult Favorites()
        {
            IList <FavoritesViewModel> vmList        = new List <FavoritesViewModel>();
            IList <SurveyData>         favoriteParks = new List <SurveyData>();

            favoriteParks = _db2.GetSurveyParks();
            foreach (SurveyData sd in favoriteParks)
            {
                Park newPark          = _db2.GetPark(sd.ParkCode);
                FavoritesViewModel vm = new FavoritesViewModel();
                vm.NumVotes        = sd.NumVotes;
                vm.ParkCode        = sd.ParkCode;
                vm.ParkName        = newPark.ParkName;
                vm.ParkDescription = newPark.ParkDescription;
                vmList.Add(vm);
            }
            return(View(vmList));
        }
예제 #7
0
        public void GetParkTest()
        {
            _db = new ParkGeekDAO("Data Source=localhost\\sqlexpress;Initial Catalog=NPGeekTest;Integrated Security=True");
            var testPark = _db.GetPark("CVNP");

            Assert.AreEqual("Cuyahoga Valley National Park", testPark.ParkName);
            Assert.AreEqual("Ohio", testPark.State);
            Assert.AreEqual(32832, testPark.Acreage);
            Assert.AreEqual(696, testPark.ElevationInFeet);
            Assert.AreEqual(125, testPark.MilesOfTrail);
            Assert.AreEqual(0, testPark.NumberOfCampsites);
            Assert.AreEqual("Woodland", testPark.Climate);
            Assert.AreEqual(2189849, testPark.AnnualVisitors);
            Assert.AreEqual("Of all the paths you take in life, make sure a few of them are dirt.", testPark.InspirationalQuote);
            Assert.AreEqual("John Muir", testPark.InspirationalQuoteSource);
            Assert.AreEqual("Though a short distance from the urban areas of Cleveland and Akron, Cuyahoga" +
                            " Valley National Park seems worlds away. The park is a refuge for native plants and wildlife, and " +
                            "provides routes of discovery for visitors. The winding Cuyahoga River gives way to deep forests, rolling " +
                            "hills, and open farmlands. Walk or ride the Towpath " +
                            "Trail to follow the historic route of the Ohio & Erie Canal", testPark.ParkDescription);
            Assert.AreEqual(0M, testPark.EntryFee);
            Assert.AreEqual(390, testPark.NumAnimalSpecies);
        }