public static List<RelatedLink> GetRelatedLinks(string property, DynamicNode model) { var rlinks = new List<RelatedLink>(); if (string.IsNullOrEmpty(model.GetPropertyValue(property))) { return rlinks; } foreach (var item in (IEnumerable<dynamic>)JsonConvert.DeserializeObject(model.GetPropertyValue(property))) { var result = new RelatedLink(); result.Url = (bool)item.isInternal ? new DynamicNode(item["internal"]).Url : item.link; result.Target = (bool)item.newWindow ? "_blank" : null; result.Caption = item.caption; rlinks.Add(result); } return rlinks; }
private static BlogPost MapToBlogPost(DynamicNode post) { return new BlogPost { Id = post.Id, Author = GetAuthor(post.GetPropertyValue("uBlogsyPostAuthor")), Date = DateTime.Parse(post.GetPropertyValue("uBlogsyPostDate", DateTime.UtcNow.ToString("dd MMM yyyy"))).ToString("dd MMM yyyy"), Title = post.GetPropertyValue("uBlogsyContentTitle", "Sorry, nothing found").Wikify(), Summary = post.GetPropertyValue("uBlogsyContentSummary", "Sorry, nothing found").Wikify(), Content = post.GetPropertyValue("uBlogsyContentBody", "Sorry, nothing found").Wikify(), Image = GetImageUrl(post.GetPropertyValue("uBlogsyPostImage")) }; }
public static IHtmlString RichText(this RazorLibraryCore ctx, DynamicNode item, string alias) { return new LazyHtmlString(() => umbraco.library.RenderMacroContent(item.GetPropertyValue(alias), ctx.Node.Id)); }