0
votes

I'm using the Models Builder to create C# classes for all my document types, in my custom controller I am retriving all the content nodes that are of a specfic type:

var viewModel = new HomePageViewModel(model);
var caseStudyNodes = viewModel.Content.AncestorOrSelf().Descendants(CaseStudy.ModelTypeAlias).ToList();

the caseStudyNodes variable is now a list of IPublished content. Is there a way to get this as a list of CaseStudy objects?

I'm using Umbraco 8 is there a diffrence between how you would do it if you where using umbraco 7

1

1 Answers

1
votes

Found the answer to my own question, just in case it helps someone else.

var caseStudyList = caseStudyNodes.Select(c => new CaseStudy(c));