Exemple #1
0
        public IActionResult TourUpdateView(string Id)
        {
            var q = _tourService.GetAllTours();

            foreach (var item in q)
            {
                item.OverView    = item.OverView.Replace("'", "'");
                item.OverView    = item.OverView.Replace("\"", """);
                item.OverView    = item.OverView.Replace("’", "'");
                item.TourSpot    = item.TourSpot?.Replace("'", "'");
                item.TourMorning = item.TourMorning?.Replace("'", "'");
                item.TourLunch   = item.TourLunch?.Replace("'", "'");
                item.Notes       = item.Notes?.Replace("'", "'");
                item.Notes       = item.Notes?.Replace("\"", """);
                _tourService.Update(item);
            }

            var tour = _tourService.GetTourByTourCode(Id);

            if (tour != null)
            {
                var tourGalleries = new List <GalleryPoolDTO>();
                var tourGallery   = _tourGalleryService.GetGalleriesByTourId(tour.Id);
                if (tourGallery != null && tourGallery.Any())
                {
                    foreach (var item in tourGallery)
                    {
                        tourGalleries.Add(_galleryPoolService.GetByGalleryId(item.GalleryId));
                    }
                }

                ViewBag.Categories = new TourCategoryViewModel()
                {
                    SelectAllCategories = _tourCategoryService.GetAllByTourIdCategories(tour.Id),
                    AllCategories       = _categoryService.GetAllCategories(),
                    SelectAllKeyword    = _keywordPoolService.GetAll(),
                    GalleryPhotos       = tourGalleries,
                    TourPlanList        = _tourPlanListService.GetAll()
                };
                return(View(tour));
            }
            else
            {
                return(View(null));
            }
        }
Exemple #2
0
        public IActionResult Detail(string tourUrl, string tourPage)
        {
            ViewBag.urlPrefix = Request.Path.ToString().Contains(tourPage ?? "anasayfa") ? Request.Path.ToString().Split(tourPage)[0] : Request.Path.ToString();


            if (tourUrl.Contains(".") || tourUrl.Contains("src") || tourUrl.ToLower().Contains("true") || tourUrl.ToLower().Contains("false"))
            {
                return(RedirectPermanent(tourUrl));
            }
            var q = _tourService.GetTourByUrl(tourUrl);

            if (q != null)
            {
                //var breadCrumb = new List<string>();
                //breadCrumb.Add(q.TourName);

                var tourCategories = _tourCategoriesService.GetAllByTourIdCategoriesName(q.Id);
                ViewBag.Category = tourCategories;
                if (tourCategories != null)
                {
                    var qs           = _tourService.GetTourByCategoryId(tourCategories.First().CategoriesId);
                    var similarTours = new List <TourDTO>();
                    foreach (var item in qs)
                    {
                        similarTours.Add(_tourService.GetTourById(item.TourId));
                    }
                    ViewBag.SimilarTours = similarTours;
                }
                else
                {
                    ViewBag.SimilarTours = new List <TourDTO>();
                }

                //var breadCrumbCategory = tourCategories.FirstOrDefault(x => q.TourUrl.Contains(x.CategoriesName));
                //breadCrumb.Add(breadCrumbCategory.CategoriesName);

                //var secondTopCategory = _categoriesService.GetParentCategoryName(breadCrumbCategory.CategoriesId);
                //breadCrumb.Add(secondTopCategory.CategoryName);
                //breadCrumb.Add(_categoriesService.GetParentCategoryName(secondTopCategory.Id).CategoryName);



                ViewBag.TourDays = _tourPlanService.GetAll().Where(x => x.TourId == q.Id).ToList();
                if (tourPage == "tour-plan")
                {
                    ViewBag.TourDays = _tourPlanService.GetAll().Where(x => x.TourId == q.Id).ToList();
                    return(View("~/Views/Tour/tourplan.cshtml", q));
                }
                else if (tourPage == "tour-map")
                {
                    return(View("~/Views/Tour/tourmap.cshtml", q));
                }
                else if (tourPage == "hotel")
                {
                    return(View("~/Views/Tour/hotel.cshtml", q));
                }
                else if (tourPage == "conditions")
                {
                    ViewBag.TourDays = _tourPlanService.GetAll().Where(x => x.TourId == q.Id).ToList();
                    return(View("~/Views/Tour/conditions.cshtml", q));
                }
                else if (tourPage == "gallery")
                {
                    ViewBag.Gallery = _tourGalleryService.GetGalleriesByTourId(q.Id).ToList();
                    return(View("~/Views/Tour/gallery.cshtml", q));
                }

                return(View(q));
            }


            return(View(null));
        }