コード例 #1
0
        public ActionResult Destinations_Read([DataSourceRequest] DataSourceRequest request, int[] ids)
        {
            IEnumerable <DestinationViewModel> data = TripXpertDAL.GetAllDestinations().Select(s => new DestinationViewModel()
            {
                DestinationID    = s.DestinationID,
                DefaultImage     = TripXpertDAL.GetDestinationDefaultImage(s.DestinationID),
                LowestPrice      = TripXpertDAL.GetLowestPriceForDestination(s.DestinationID, null, null),
                TestimonialID    = s.TestimonialID,
                IsSpecial        = s.IsSpecial,
                Title            = s.Title,
                ShortDescription = s.ShortDescription.Split('|'),
                FullDescription  = s.FullDescription,
                Duration         = s.Duration,
                VideoURL         = s.VideoURL,
                Rating           = s.Rating,
                DetailImage      = TripXpertDAL.GetDestinationDefaultImage(s.DestinationID),
            });

            if (ids != null)
            {
                data = data.Where(d => ids.Contains(d.DestinationID));
            }

            return(Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult GetDestinations()
        {
            //TripXpertDAL.GetSpecialDestinations()
            List <Destination> data = TripXpertDAL.GetAllDestinations();

            foreach (Destination item in data)
            {
                item.DefaultImage = TripXpertDAL.GetDestinationDefaultImage(item.DestinationID);
                item.LowestPrice  = TripXpertDAL.GetLowestPriceForDestination(item.DestinationID, null, null);
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult DestinationDetails(int id)
        {
            DestinationViewModel destination = TripXpertDAL.GetAllDestinations().Where(x => x.DestinationID == id).Select(s => new DestinationViewModel()
            {
                DestinationID    = s.DestinationID,
                DefaultImage     = TripXpertDAL.GetDestinationDefaultImage(s.DestinationID),
                DetailImage      = TripXpertDAL.GetDestinationDetailImage(s.DestinationID),
                LowestPrice      = TripXpertDAL.GetLowestPriceForDestination(s.DestinationID, null, null),
                TestimonialID    = s.TestimonialID,
                IsSpecial        = s.IsSpecial,
                Title            = s.Title,
                ShortDescription = s.ShortDescription.Split('|'),
                FullDescription  = s.FullDescription,
                Duration         = s.Duration,
                VideoURL         = s.VideoURL,
                TourInfos        = TripXpertDAL.GetTourInfos(s.DestinationID).Select(t => new Models.TourInfo()
                {
                    InfoID             = t.InfoID,
                    DestinationID      = t.DestinationID,
                    StartDate          = t.StartDate,
                    EndDate            = t.EndDate,
                    PerPersonSharing   = t.PerPersonSharing,
                    PerSingleOccupancy = t.PerSingleOccupancy,
                    PerChild           = t.PerChild,
                    Duration           = t.Duration,
                    TourDates          = GetTourDates((DateTime)t.StartDate, (DateTime)t.EndDate)
                }),
                Testimonial = new Models.Testimonial(TripXpertDAL.GetTestimonial(s.TestimonialID)),
                Attractions = TripXpertDAL.GetAttactionsForDestionation(s.DestinationID).Select(a => new Models.Attraction()
                {
                    AttractionID  = a.AttractionID,
                    DestinationID = a.DestinationID,
                    Title         = a.Title,
                    Location      = a.Location,
                    Description   = a.Description,
                    Image         = new Models.Image(TripXpertDAL.GetAttractionImage(a.AttractionID))
                }),
                MapInfo = new MapInfo()
                {
                    ZoomSettings = TripXpertDAL.GetMapZoomSettings(s.DestinationID, 320, 350),
                    Markers      = TripXpertDAL.GetMarkers(s.DestinationID).Select(m => new Marker((double)m.Latitude, (double)m.Longitude, s.Title))
                }
            }).FirstOrDefault();


            return(View(destination));
        }
コード例 #4
0
        public ActionResult PriceInfo_Read([DataSourceRequest] DataSourceRequest request)
        {
            var data = TripXpertDAL.GetAllDestinations().Select(s => new DestinationViewModel()
            {
                DestinationID    = s.DestinationID,
                DefaultImage     = TripXpertDAL.GetDestinationDefaultImage(s.DestinationID, 'M'),
                LowestPrice      = TripXpertDAL.GetLowestPriceForDestination(s.DestinationID, null, null),
                TestimonialID    = s.TestimonialID,
                IsSpecial        = s.IsSpecial,
                Title            = s.Title,
                ShortDescription = s.ShortDescription.Split('|'),
                FullDescription  = s.FullDescription,
                Duration         = s.Duration,
                VideoURL         = s.VideoURL,
            });

            return(Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public ActionResult Destinations_First()
        {
            IEnumerable <DestinationViewModel> data = TripXpertDAL.GetFirstDestinations().Select(s => new DestinationViewModel()
            {
                DestinationID    = s.DestinationID,
                DefaultImage     = TripXpertDAL.GetDestinationDefaultImage(s.DestinationID),
                LowestPrice      = TripXpertDAL.GetLowestPriceForDestination(s.DestinationID, null, null),
                TestimonialID    = s.TestimonialID,
                IsSpecial        = s.IsSpecial,
                Title            = s.Title,
                ShortDescription = s.ShortDescription.Split('|'),
                FullDescription  = s.FullDescription,
                Duration         = s.Duration,
                VideoURL         = s.VideoURL,
                Rating           = s.Rating,
                DetailImage      = TripXpertDAL.GetDestinationDefaultImage(s.DestinationID),
            });

            return(Json(data, JsonRequestBehavior.AllowGet));
        }