public ActionResult LandmarksFromKeywordsJSON(string keywords) { List<Landmark> landmarks = landmarkDAL.GetAllLandmarksFromKeywords(keywords); foreach (Landmark landmark in landmarks) { landmark.Schedule = landmarkDAL.GetLandmarkSchedule(landmark.Id); landmark.Categories = landmarkDAL.GetLandmarkCategories(landmark.Id); } return Json(landmarks, JsonRequestBehavior.AllowGet); }
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)); }
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)); }