Documentation

Content

Get Method

Syntax:

public IPage Get(int contentId)

Parameters:

Parameter Type Description
contentId int The content id of the page to retrieve

Return value:

Type Description
IPage The content object representing the page

Examples:

@Api.Content.Get(1234).Title.Get(Model.CurrentUser.DefaultCulture)


Get Method

Syntax:

public T Get<T>(int contentId)

Parameters:

Parameter Type Description
contentId int The content id of the page to retrieve

Return value:

Type Description
T The object represented by the type T

Examples:

@Api.Content.Get<Document>(1234).CurrentFile.FileName


GetAll Method

Syntax:

public IList<IPage> GetAll(params int[] contentIds)

Parameters:

Parameter Type Description
contentIds params int[] The array or comma separated list of content IDs to retrieve

Return value:

Type Description
IList<IPage> The list of content pages

Examples:

<ul>
@foreach (var content in Api.Content.GetAll(1234, 1235, 1236))
{
    <li>@content.Title.Get(Model.CurrentUser.DefaultCulture)</li>
}
</ul>

//or

<ul> // where contentIds is a List<int> or int[] @foreach (var content in Api.Content.GetAll(contentIds)) { <li>@content.Title.Get(Model.CurrentUser.DefaultCulture)</li> } </ul>



GetChildren Method

Syntax:

public IList<IPage> GetChildren(int contentId)

Parameters:

Parameter Type Description
contentId int The content id of the parent page whose children you want to retrieve

Return value:

Type Description
IList<IPage> The list of content pages

Examples:

<ul>
@foreach (var content in Api.Content.GetChildren(1234))
{
    <li>@content.Title.Get(Model.CurrentUser.DefaultCulture)</li>
}
</ul>