public ExternalReviewLink AddLink(ContentReference contentLink, bool isEditable, TimeSpan validTo) { var externalReviewLink = new ExternalReviewLinkDds { ContentLink = contentLink, IsEditable = isEditable, Token = Guid.NewGuid().ToString(), ValidTo = DateTime.Now.Add(validTo) }; GetStore().Save(externalReviewLink); return(ExternalReviewLink.FromExternalReview(externalReviewLink, _externalReviewOptions.ReviewsUrl, _externalReviewOptions.ContentPreviewUrl)); }
public ExternalReviewLink GetContentByToken(string token) { if (string.IsNullOrWhiteSpace(token)) { return(null); } token = token.ToLower(); var externalReviewLinkDds = GetStore().Items <ExternalReviewLinkDds>() .FirstOrDefault(x => x.Token == token); if (externalReviewLinkDds == null) { return(null); } return(ExternalReviewLink.FromExternalReview(externalReviewLinkDds, _externalReviewOptions.ReviewsUrl, _externalReviewOptions.ContentPreviewUrl)); }
public IEnumerable <ExternalReviewLink> GetLinksForContent(ContentReference contentLink) { return(GetStore().Items <ExternalReviewLinkDds>().Where(x => x.ContentLink == contentLink).ToList().Select(x => ExternalReviewLink.FromExternalReview(x, _externalReviewOptions.ReviewsUrl, _externalReviewOptions.ContentPreviewUrl))); }