public ActionResult Jump(int id) { var proposal = _context.Proposals.SingleOrDefault(m => m.Id == id); if (proposal == null || proposal.Submitted) { return(HttpNotFound()); } if (!proposal.IsEditable(User.Identity.GetUserId())) { return(HttpNotFound()); } if (proposal.ExternalReviewId == null) { ExternalReview er = new ExternalReview(); proposal.ExternalReview = er; Thread t = new Thread(); _context.Threads.Add(t); er.Thread = t; _context.ExternalReviews.Add(er); _context.SaveChanges(); return(RedirectToAction("Index", "ExternalReview", new { id = proposal.Id })); } else { return(RedirectToAction("Index", "ExternalReview", new { id = proposal.Id })); } }
public bool IsPublished(IContent content, PublishedStateCondition condition) { if (ExternalReview.IsInExternalReviewContext && ExternalReview.CustomLoaded.Contains(content.ContentLink.ToString())) { var cachedContent = ExternalReview.GetCachedContent(_languageResolver.GetPreferredCulture(), content.ContentLink); if (cachedContent != null) { return(true); } } return(_defaultService.IsPublished(content, condition)); }
public Review AddExternalReview(Review review) { if (review.Rating == 0 || review.Comment.Length > 15) { throw new Exception("Review must have a rating of at least 1 star and a comment length of more than 15 characters."); } if (string.IsNullOrEmpty(review.UrlToReview) || string.IsNullOrEmpty(review.SourceOfReview)) { throw new Exception("External Reviews require a link to the site or location of the review."); } var externalReview = new ExternalReview(review); _context.Reviews.Add(externalReview); _context.SaveChanges(); return(externalReview); }
public ActionResult Jump(int id) { var proposal = _context.Proposals.SingleOrDefault(m => m.Id == id); if (proposal == null || proposal.Submitted) { return(HttpNotFound()); } if (proposal.ExternalReviewId == null) { ExternalReview er = new ExternalReview(); proposal.ExternalReview = er; _context.ExternalReviews.Add(er); _context.SaveChanges(); return(RedirectToAction("Index", "ExternalReview", new { id = proposal.Id })); } else { return(RedirectToAction("Index", "ExternalReview", new { id = proposal.Id })); } }