Exemplo n.º 1
0
 public ActionResult LandmarksInTripJSON(int tripId)
 {
     List<Landmark> landmarksInTrip = landmarkDAL.GetAllLandmarksInTrip(tripId);
     foreach (Landmark landmark in landmarksInTrip)
     {
         landmark.Categories = landmarkDAL.GetLandmarkCategories(landmark.Id);
     }
     return Json(landmarksInTrip, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 2
0
        public ActionResult MyTrips()
        {
            if (!base.IsAuthenticated)
            {
                RedirectToAction("Login", "Home");
            }

            // Get all trips associated with current user
            int         currentUserId = userDAL.GetUserId(base.CurrentUser);
            List <Trip> allUserTrips  = tripDAL.GetAllUserTrips(currentUserId);

            // Assign landmarks to each trip and include landmark categories
            for (int i = 0; i < allUserTrips.Count; i++)
            {
                Trip trip = allUserTrips[i];
                trip.Landmarks = landmarkDAL.GetAllLandmarksInTrip(trip.Id);
                foreach (Landmark landmark in trip.Landmarks)
                {
                    landmark.Categories = landmarkDAL.GetLandmarkCategories(landmark.Id);
                }
            }

            return(View("MyTrips", allUserTrips));
        }