Пример #1
0
        public ActionResult LandmarkDetail(string PlaceId)
        {
            if (PlaceId == null)
            {
                return(View("Index", "Home"));
            }
            UserSession session  = GetActiveUser();
            Landmark    landmark = landmarkDAL.GetLandmark(PlaceId);

            return(View(landmark));
        }
        public IActionResult Detail(string id, DisplayReviewsViewModel model)
        {
            IList <Landmark> landMarkDetail = _landmarkDAL.GetLandmark(id);
            IList <Review>   reviews        = _reviewDAL.GetAllReviews(id);

            model.Landmarks = landMarkDetail;
            model.Reviews   = reviews;

            var abs = Path.GetFullPath("~/wwwroot/userImages/").Replace("~\\", "");

            model.Images = Directory.EnumerateFiles(abs)
                           .Select(fn => Path.GetFileName(fn));

            return(View(model));
        }
Пример #3
0
        private Trip PopulateTrip(MyTripViewModel model)
        {
            // Create new Trip
            Trip trip = new Trip();

            // Assign trip name, description, and date
            trip.Name = model.TripName;
            trip.Description = model.TripDescription;
            trip.TripDate = model.TripDate;

            // Assign trip landmarks selected by user and bound to ViewModel
            List<Landmark> landmarksInTrip = new List<Landmark>();
            for (int i = 0; i < model.SelectedLandmarkIds.Length; i++)
            {
                int landmarkId = model.SelectedLandmarkIds[i];
                landmarksInTrip.Add(landmarkDAL.GetLandmark(landmarkId));
                landmarksInTrip[i].Categories = landmarkDAL.GetLandmarkCategories(landmarkId);
            }
            trip.Landmarks = landmarksInTrip;

            return trip;
        }