public void Add(CommentUpdate commentUpdate) { //var categories = _categoryRepo.All.Where(a => perspectivePostUpdate.SelectedCategories.Contains(a.Id)); var comment = new Comment { PerspectivePostId = commentUpdate.PerspectivePostId, Name = commentUpdate.Name, Email = commentUpdate.Email, Content = commentUpdate.Content, IsApproved = commentUpdate.IsApproved, PostedOn = commentUpdate.PostedOn }; //perspectivePost.Categories = new System.Collections.Generic.List<Category>(); //perspectivePost.Categories.AddRange(categories.ToList()); _commentRepo.Add(comment); }
public void Update(CommentUpdate PerspectivePost) { }
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); }