Esempio n. 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));
            }
        }