public ActionResult TourPerspectives(string tourpermalink, int page = 1)
        {
            SEOToolStaticPage SEOTool = _seoToolStaticPageQueryService.FindSEOToolStaticPageByPermalink(tourpermalink);

            if (SEOTool != null)
            {
                ViewBag.FocusKeyword    = SEOTool.FocusKeyword;
                ViewBag.MetaDescription = SEOTool.MetaDescription;
                ViewBag.Title           = SEOTool.SEOTitle;
            }

            var perspectiveposts = _perspectiveService.PostByTour(tourpermalink);

            var blog     = perspectiveposts.Paged(page, DefaultPerPage, "UpdatedAt desc");
            var allTours = _perspectiveService.AllTours().ToList();

            var viewModel = new LatestPerspectivePost
            {
                Count                 = perspectiveposts.Count(),
                PerspectivePosts      = blog.ToList(),
                Tours                 = allTours,
                selectedtourpermalink = tourpermalink,
                PagingInfo            = new PagingInfo
                {
                    CurrentPage = page,
                    PerPage     = DefaultPerPage,
                    TotalItems  = perspectiveposts.Count(),
                }
                //,
                //Comment = new Models.Comments.CommentEdit()
            };

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult Show(string permalink)
        {
            try
            {
                var perspectiveposts = _perspectiveService.PostByTour(permalink);
                var tour             = _tourService.FindByPermalink(permalink);

                if (tour == null || !tour.IsPublished)
                {
                    return(HttpNotFound());
                }
                int OrganizationId = UserContext.Organization.Id;
                var tourShow       = PopulateTourShow(tour, OrganizationId);

                SEOTool SEOTool = new SEOTool();

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


                ViewBag.FocusKeyword    = SEOTool.FocusKeyword;
                ViewBag.MetaDescription = SEOTool.MetaDescription;
                ViewBag.Title           = SEOTool.SEOTitle;


                tourShow.PerspectivePosts = perspectiveposts.OrderByDescending(m => m.UpdatedAt).Take(2).ToList();

                return(TourView(tourShow));
            }
            catch (Exception e)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(e);
                return(HttpNotFound());
            }
        }