Umbraco razor snippets

Umbraco

We all know it, - That , - You know snippet you just need to get at umbraco node by id, or that content based on the content type, - My memory isent really functional any more, - so therefore this is my snippets page. - Feel more than free to add good snippets to the page by filling out the contact form on the main page.

Please note the difference between using the snippets on a either a page / partial view / partial view macro file

Umbraco get node by id

@foreach(var item in Model.NodeById(1052).Children().Where("Visible"))
{
//DoSomething
}

 

Umbraco get content by document type

@foreach(var item in Model.AncestorOrSelf(1).DescendantsOrSelf("DocTypeAlias").Where("Visible"))
{

//DoSomething
}