public ActionResult Destinations(bool?isSpecial, int?priceFrom, int?priceTo)
        {
            int[] model = null;
            var   items = TripXpertDAL.GetAllDestinations();

            if (isSpecial != null)
            {
                items = items.Where(x => x.IsSpecial == isSpecial).ToList();
            }

            if (priceFrom != null)
            {
                items = items.Where(x => TripXpertDAL.GetLowestPriceForDestination(x.DestinationID, null, null) >= priceFrom).ToList();
            }

            if (priceTo != null)
            {
                items = items.Where(x => TripXpertDAL.GetLowestPriceForDestination(x.DestinationID, null, null) <= priceTo).ToList();
            }

            if (isSpecial != null || priceFrom != null || priceTo != null)
            {
                model = items.Select(x => x.DestinationID).ToArray();
            }


            return(View(model));
        }
        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));
        }
 public ActionResult AttractionInfoListView_Read([DataSourceRequest] DataSourceRequest request, string imageUrl)
 {
     if (string.Empty != imageUrl)
     {
         string url  = imageUrl.Split(new char[] { '/' }).Last();
         object data = TripXpertDAL.GetFullAttractionInfo(url);
         return(Json(((IEnumerable)data).Cast <object>().ToList().ToDataSourceResult(request)));
     }
     return(Json(string.Empty));
 }
Ejemplo n.º 4
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));
        }
        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));
        }
Ejemplo n.º 6
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));
        }
        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));
        }
Ejemplo n.º 8
0
 public JsonResult GetCountries()
 {
     return(Json(TripXpertDAL.GetCountries(), JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 9
0
        public JsonResult GetCountries()
        {
            var countries = TripXpertDAL.GetCountries();

            return(Json(countries, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
 public JsonResult GetDestinationImages(int destinationId)
 {
     return(Json((TripXpertDAL.GetAllDestinationImages(destinationId) as IEnumerable <object>).Take(7), JsonRequestBehavior.AllowGet));
 }
        public ActionResult AttractionImages_Read([DataSourceRequest] DataSourceRequest request)
        {
            object data = TripXpertDAL.GetAllAttractionImages();

            return(Json(((IEnumerable)data).Cast <object>().ToList().ToDataSourceResult(request)));
        }
Ejemplo n.º 12
0
        public ActionResult GetDestinationsQuery(string priceRange, string offerType)
        {
            var result = TripXpertDAL.GetDestinationsQueryString(String.Empty, offerType == "" ? "All" : offerType, priceRange);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 13
0
 public JsonResult GetSpecialDestinations()
 {
     return(Json(TripXpertDAL.GetSpecialDestinations(), JsonRequestBehavior.AllowGet));
 }