Beispiel #1
0
        // GET: Itinerary/Create
        public ActionResult Create()
        {
            UserSession     session   = GetActiveUser();
            List <Landmark> landmarks = landmarkDAL.GetAllLandmarks();

            return(View(landmarks));
        }
Beispiel #2
0
        public ActionResult Category()
        {
            ThingsToDoViewModel viewModel = new ThingsToDoViewModel();

            viewModel.Landmarks = landmarkDAL.GetAllLandmarks();
            foreach (Landmark landmark in viewModel.Landmarks)
            {
                landmark.Categories = landmarkDAL.GetLandmarkCategories(landmark.Id);
            }
            viewModel.Category = "Restaurants";
            return(View("Category", viewModel));
        }
Beispiel #3
0
        // GET: Itinerary
        public ActionResult Detail()
        {
            //Default session if User isn't logged in
            UserSession userSession = GetActiveUser();

            if (userSession.UserName == "Anonymous")
            {
                return(RedirectToAction("Login", "Home"));
            }
            ItineraryLandmarks model;


            if (TempData["Temp.ItnId"] == null)
            {
                tempId = itineraryDAL.CreateItinerary(new Itinerary("Untitled", DateTime.Now.AddDays(1), "Enter Description", userSession.Email));
                TempData["Temp.ItnId"] = tempId;
                model = new ItineraryLandmarks()
                {
                    Landmarks    = landmarkDAL.GetAllLandmarks(),
                    ItnLandmarks = landmarkDAL.GetAllLandmarks(tempId.Value),
                    Itinerary    = itineraryDAL.GetItinerary(tempId.Value)
                };
            }
            else
            {
                model = new ItineraryLandmarks()
                {
                    Landmarks    = landmarkDAL.GetAllLandmarks(),
                    Itinerary    = itineraryDAL.GetItinerary(Convert.ToInt32(TempData["Temp.ItnId"])),
                    ItnLandmarks = landmarkDAL.GetAllLandmarks(Convert.ToInt32(TempData["Temp.ItnId"]))
                };
                tempId = model.Itinerary.Id;
                TempData["Temp.ItnId"] = tempId;
            }

            return(View(model));
        }
Beispiel #4
0
        private MyTripViewModel PopulateMyTripViewModel()
        {
            MyTripViewModel myTripViewModel = new MyTripViewModel();

            // Retrieve all categories
            myTripViewModel.Categories = landmarkDAL.GetAllCategories();

            // Retrieve all landmarks and their properties
            List<Landmark> allLandmarks = landmarkDAL.GetAllLandmarks();
            foreach (Landmark landmark in allLandmarks)
            {
                landmark.Schedule = landmarkDAL.GetLandmarkSchedule(landmark.Id);
                landmark.Categories = landmarkDAL.GetLandmarkCategories(landmark.Id);
            }

            return myTripViewModel;
        }