Пример #1
0
        public IActionResult Index() //we create a new survey and get a list of parks
        {
            Survey survey = new Survey();

            survey.ParkList = parkDao.GetAllParks();

            return(View(survey)); //create new view bound to our survey
        }
Пример #2
0
        public void FindListOfParks()
        {
            bool foundMyPark = false;

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("INSERT INTO park (parkCode, parkName, state, acreage, elevationInFeet, milesOfTrail, numberOfCampsites, climate, yearFounded, annualVisitorCount, inspirationalQuote, inspirationalQuoteSource, parkDescription, entryFee, numberOfAnimalSpecies) VALUES ('TEST', 'TestPark', 'Ohio', 1, 1, 1, 1, 'hot', 1999, 1, 'testquote', 'me', 'thisparkdoesntexist', 1, 1);", conn);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
            }
            List <Park> parks = parkDao.GetAllParks();

            //variables
            foreach (Park park in parks)
            {
                if (park.ParkCode == "TEST")
                {
                    foundMyPark = true;
                    break;
                }
            }
            Assert.IsTrue(foundMyPark);
        }
        public IActionResult Index()
        {
            IList <Park> parks = parkDao.GetAllParks();

            return(View(parks));
        }
Пример #4
0
        public IActionResult Index()
        {
            var parksList = _parkDao.GetAllParks();

            return(View(parksList));
        }
Пример #5
0
        public IActionResult Index() //get list of parks and send it to the index view
        {
            List <Park> parks = parkDao.GetAllParks();

            return(View(parks));
        }