Пример #1
0
        public IActionResult Trip(string tag)
        {
            var trip      = TripRepo.GetAllTrips().Where(t => t.TripTag == tag).FirstOrDefault();
            var tripItems = TripItemRepo.GetTripItems().Where(ti => ti.TripTag == trip.TripTag).OrderBy(t => t.PublishDate);

            return(View("Trip", new ViewModels.Trip
            {
                TripTag = trip.TripTag,
                Title = trip.Title,
                Image = trip.Image,
                TripHeader = trip.TripHeader,
                TripDescription = GetTripItemContent(trip.TripDescription),
                TripItems = tripItems
            }));
        }
Пример #2
0
        public IActionResult Trips()
        {
            var vm = new List <ViewModels.Trip>();

            foreach (var trip in TripRepo.GetAllTrips().OrderBy(t => t.TripOrder))
            {
                vm.Add(new ViewModels.Trip
                {
                    TripTag         = trip.TripTag,
                    Title           = trip.Title,
                    Image           = trip.Image,
                    TripHeader      = trip.TripHeader,
                    TripDescription = GetTripItemContent(trip.TripDescription)
                });
            }
            return(View("Trips", vm));
        }
Пример #3
0
        public IActionResult Index()
        {
            var trips     = TripRepo.GetAllTrips().OrderBy(t => t.TripOrder);
            var tripItems = TripItemRepo.GetTripItems().OrderByDescending(t => t.PublishDate);

            return(View(new Home
            {
                Carousels = trips,
                TripItems = tripItems.Select(ti => new HomeTripItem
                {
                    Tag = ti.Tag,
                    TripTag = ti.TripTag,
                    HeaderImage = ti.HeaderImage,
                    PublishDate = ti.PublishDate,
                    SubTitle = ti.SubTitle,
                    Title = ti.Title,
                    TripTitle = trips
                                .Where(t => t.TripTag == ti.TripTag)
                                .OrderBy(t => t.TripOrder)
                                .Select(t => t.Title)
                                .FirstOrDefault()
                })
            }));
        }