Пример #1
0
        public JsonResult DailyTourUpdate(string TourMorning, string TourLunch, string TourAfternoon, string Notes, int TourId)
        {
            var tour = _tourService.GetTourById(TourId);

            if (tour != null)
            {
                tour.TourMorning   = TourMorning.Replace("'", "'");
                tour.TourLunch     = TourLunch.Replace("'", "'");
                tour.TourAfternoon = TourAfternoon.Replace("'", "'");
                tour.Notes         = Notes.Replace("'", "'");
                _tourService.Update(tour);
                return(Json(true));
            }
            else
            {
                return(Json(false));
            }
        }
Пример #2
0
        public IActionResult Detail(string categoryName, string parentCategoryName, string subParentCategoryName)
        {
            if (categoryName.Contains(".") || categoryName.Contains("src") || categoryName.ToLower().Contains("true") || categoryName.ToLower().Contains("false"))
            {
                return(RedirectPermanent(categoryName));
            }

            var sa = $"/{categoryName}";

            if (!string.IsNullOrEmpty(parentCategoryName))
            {
                sa = $"/{parentCategoryName}/{categoryName}";
            }

            if (!string.IsNullOrEmpty(subParentCategoryName))
            {
                sa = $"/{parentCategoryName}/{subParentCategoryName}/{categoryName}";
            }

            var categoryModel = _categoryService.GetByUrl(sa);

            if (categoryModel == null)
            {
                return(RedirectToAction("Page", "StaticPages", new { pageUrl = categoryName }));
            }

            var t = _categoriesSliderService.GetGalleriesByCategoryId(categoryModel.Id);

            var s = new List <string>();

            s.AddRange(t.Select(x => x.GalleryId).ToList <string>());
            var subCategory = _categoryService.GetAllSubCategories(categoryModel.Id).ToList();
            var imgs        = new Dictionary <int, string>();

            subCategory.ForEach(x => imgs.Add(x.Id, x.ImagePath));

            CategoryModel cm = new CategoryModel(_galleryPoolService, s, imgs);

            //ViewBag.SubCategories = subCategory;
            ViewBag.CategorySlider = cm;
            var subCategoryList = _categoryService.GetAllSubCategories(categoryModel.Id).ToList();

            foreach (var item in subCategoryList)
            {
                subCategoryList.FirstOrDefault(x => x.Id == item.Id).SubCategory = _categoryService.GetAllSubCategories(item.Id).ToList();
            }

            ViewBag.SubCategories = subCategoryList;
            var tourList = new List <TourDTO>();

            if (_categoryService.GetAllSubCategories(categoryModel.Id).Count() == 0)
            {
                var categoryTours = _tourCategoryService.GetAllByCategoriesofTours(categoryModel.Id).ToList();
                foreach (var item in categoryTours)
                {
                    tourList.Add(_tourService.GetTourById(item.TourId));
                }
            }
            ViewBag.TourList = tourList;

            return(View(categoryModel));
        }
Пример #3
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));
        }