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); }
public ActionResult PerspectivePost(LatestPerspectivePost latestPerspectivePost, int Id, string TourPermalink, string PerspectivePermalink) { if (ModelState.IsValid) { // var commentUpdate = Mapper.Map<CommentUpdate>(latestPerspectivePost.Comment); CommentUpdate commentUpdate = new CommentUpdate(); commentUpdate.Name = latestPerspectivePost.Name; commentUpdate.Email = latestPerspectivePost.Email; commentUpdate.Content = latestPerspectivePost.Content; commentUpdate.PerspectivePostId = Id; commentUpdate.IsApproved = true; commentUpdate.PostedOn = DateTime.Now; _commentCommandService.Add(commentUpdate); //TempData["CommentSuccess"] = "Comment created successfully."; return RedirectToRoute("perspective-post", new { tourpermalink = TourPermalink, permalink = PerspectivePermalink }); } var post = _perspectiveService.FindPerspectivePost(PerspectivePermalink); var allTours = _perspectiveService.AllTours().ToList(); SEOTool SEOTool = new SEOTool(); if (post != null && post.FirstOrDefault() != null && post.First().SEOTools != null && post.First().SEOTools.Count > 0) SEOTool = post.First().SEOTools.First(); ViewBag.FocusKeyword = SEOTool.FocusKeyword; ViewBag.MetaDescription = SEOTool.MetaDescription; ViewBag.SEOTitle = SEOTool.SEOTitle; latestPerspectivePost.FocusKeyword = SEOTool.FocusKeyword; latestPerspectivePost.MetaDescription = SEOTool.MetaDescription; latestPerspectivePost.SEOTitle = SEOTool.SEOTitle; latestPerspectivePost.PerspectivePosts = post.ToList(); latestPerspectivePost.selectedtourpermalink = TourPermalink; latestPerspectivePost.Tours = allTours; return View(latestPerspectivePost); }