Skip to content

Instantly share code, notes, and snippets.

@albertromkes
Last active December 15, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertromkes/5189838 to your computer and use it in GitHub Desktop.
Save albertromkes/5189838 to your computer and use it in GitHub Desktop.
public class ArticleBuilder : BuilderBase
{
private ComponentPresentation TridionComponentPresentation { get; set; }
public ArticleBuilder(ComponentPresentation componentPresentation)
{
TridionComponentPresentation = componentPresentation;
}
public Article Build()
{
var tridionComponent = TridionComponentPresentation.Component;
var articleViewModel = new Article
{
Title = tridionComponent.Fields["title"].Value,
Summary = ResolveRichText(tridionComponent.Fields["short_intro"].Value),
RelatedLinks = tridionComponent.Fields["related_links"].Values.ToList()
//Etc
}
//Work magic for XPM
MakeInlineEditable(articleViewModel);
return articleViewModel;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment