コード例 #1
0
        public void DepartureCity_returns_Seattle()
        {
            DepartureCity result      = DepartureCity.Find(1);
            string        finalResult = result.GetDepartureCity();

            Assert.AreEqual("Seattle", finalResult);
        }
コード例 #2
0
        public ActionResult AddDepartureToArrival(int departureId)
        {
            ArrivalCity   arrival   = ArrivalCity.Find(departureId);
            DepartureCity departure = DepartureCity.Find(Int32.Parse(Request.Form["departure-id"]));

            arrival.SetDepartures(departure); //Want to run the join table method
            return(RedirectToAction("ViewArrivals", new { id = departureId }));
        }
コード例 #3
0
        public ActionResult AddArrivalToDeparture(int arrivalId)
        {
            DepartureCity departure = DepartureCity.Find(arrivalId);
            ArrivalCity   arrival   = ArrivalCity.Find(Int32.Parse(Request.Form["arrival-id"]));

            departure.SetArrivals(arrival); //Want to run the join table method
            return(RedirectToAction("ViewDepartures", new { id = arrivalId }));
        }
コード例 #4
0
        public void DepartureCityId_returns_all_ArrivalId()
        {
            DepartureCity result      = DepartureCity.Find(9);
            int           finalResult = result.GetArrivals()[0].GetId();

            Console.WriteLine(finalResult);

            Assert.AreEqual(1, finalResult);
        }
コード例 #5
0
        public ActionResult ViewDepartures(int id)
        {
            Dictionary <string, object> model        = new Dictionary <string, object>();
            DepartureCity      selectedDepartureCity = DepartureCity.Find(id);
            List <ArrivalCity> flights     = selectedDepartureCity.GetArrivals();
            List <ArrivalCity> allArrivals = ArrivalCity.GetAll();

            model.Add("selectedDepartureCity", selectedDepartureCity);
            model.Add("flights", flights);
            model.Add("allArrivals", allArrivals);
            return(View(model));
        }