Example #1
0
        public ActionResult Edit(int tourId)
        {
            var tour     = _tourQueryService.FindTour(tourId);
            var tourEdit = Mapper.Map <TourEdit>(tour);

            tourEdit.AvailabilityStatusList = _tourQueryService.Availabilities();
            tourEdit.CategoryList           = _tourQueryService.Categories();
            tourEdit.CategoriesFromPost     = new System.Collections.Generic.List <string>();

            if (tour.SEOTools != null && tour.SEOTools.Count > 0)
            {
                SEOTool SEOTool = tour.SEOTools.First();
                tourEdit.SEOTitle        = SEOTool.SEOTitle;
                tourEdit.FocusKeyword    = SEOTool.FocusKeyword;
                tourEdit.MetaDescription = SEOTool.MetaDescription;
            }


            foreach (Category cat in tour.Categories)
            {
                tourEdit.CategoriesFromPost.Add(cat.Id.ToString());
            }
            tourEdit.TourTypeList = _tourQueryService.TourTypes();
            return(View(tourEdit));
        }
        public ActionResult Create(PerspectiveEdit perspectiveEdit)
        {
            if (ModelState.IsValid)
            {
                /*Commented -> Category replaced by tours
                 * perspectiveEdit.SelectedCategories = new System.Collections.Generic.List<int>();
                 * foreach (string s in perspectiveEdit.CategoriesFromPost)
                 *  perspectiveEdit.SelectedCategories.Add(Convert.ToInt32(s));
                 */
                var perspectivePostUpdate = Mapper.Map <PerspectivePostUpdate>(perspectiveEdit);
                perspectivePostUpdate.UserId    = UserContext.UserId;
                perspectivePostUpdate.Permalink = perspectivePostUpdate.Headline.Replace(" ", "_");
                _perspectiveCommandService.Add(perspectivePostUpdate);
                TempData["Success"] = "Blog created successfully.";


                var tour = _tourQueryService.FindTour(perspectiveEdit.TourId);

                TempData["PerspectivesPermalink"] = perspectivePostUpdate.Permalink;
                TempData["TourPermalink"]         = tour.Permalink;


                return(RedirectToRoute("create-perspective"));
            }

            /*Commented -> Category replaced by tours
             * if (perspectiveEdit.CategoriesFromPost == null)
             *  perspectiveEdit.CategoriesFromPost = new System.Collections.Generic.List<string>();
             * perspectiveEdit.CategoryList = _perspectiveQueryService.Categories();
             */

            perspectiveEdit.TourList = _tourQueryService.Tours();

            return(View(perspectiveEdit));
        }
        private void UpdateTargets(DiscountCode discountCode, DiscountCodeEdit discountCodeEdit)
        {
            if (discountCode.Tours == null)
            {
                discountCode.Tours = new List <Tour>();
            }
            discountCode.Tours.Clear();
            if (!discountCode.IsGlobal && discountCodeEdit.TourId != null)
            {
                discountCode.Tours =
                    discountCodeEdit.TourId.Select(i => _tourQueryService.FindTour(Convert.ToInt32(i))).ToList();
            }

            if (discountCode.Products == null)
            {
                discountCode.Products = new List <Product>();
            }
            discountCode.Products.Clear();
            if (!discountCode.IsGlobal && discountCodeEdit.ProductId != null)
            {
                discountCode.Products =
                    discountCodeEdit.ProductId.Select(i => _productQueryService.FindProduct(Convert.ToInt32(i))).ToList();
            }

            if (discountCode.ProductVariants == null)
            {
                discountCode.ProductVariants = new List <ProductVariant>();
            }
            discountCode.ProductVariants.Clear();
            if (!discountCode.IsGlobal && discountCodeEdit.ProductVariantId != null)
            {
                discountCode.ProductVariants =
                    discountCodeEdit.ProductVariantId.Select(i => _productQueryService.FindProductVariant(Convert.ToInt32(i))).ToList();
            }
        }
Example #4
0
        public ActionResult Index(int tourId)
        {
            var tour = _tourQueryService.FindTour(tourId);

            if (tour == null)
            {
                return(HttpNotFound());
            }

            var timelineItems = _tourTimelineQueryService.TimelineItems(tourId).OrderBy(i => i.Position);

            return(View(new TimelineIndex
            {
                TourId = tour.Id,
                TourName = tour.Name,
                TourCode = tour.Code,
                TourPermalink = tour.Permalink,
                Count = timelineItems.Count(),
                Items = timelineItems
            }));
        }
Example #5
0
        public ActionResult Index(int tourId)
        {
            var tour       = _tourQueryService.FindTour(tourId);
            var departures = _departureQueryService.Departures(tour);

            if (tour == null || departures == null)
            {
                return(HttpNotFound());
            }

            var deps = departures.ToArray();

            return(View(new DeparturesIndex
            {
                TourId = tour.Id,
                TourName = tour.Name,
                TourCode = tour.Code,
                TourPermalink = tour.Permalink,
                Departures = deps,
                Count = deps.Count()
            }));
        }
Example #6
0
 // GET api/tours/5
 public ApiTour Get(int id)
 {
     return(Mapper.Map <ApiTour>(_tourQueryService.FindTour(id)));
 }