ModelsAsync<TModel>(IRedaktContext, IEnumerable<string>, Func<TModel, bool>, Nullable<CultureInfo>)

Gets a list of view models for the specified node ids and culture. Only returns models for content that can be cast to TModel.

public static async ValueTask<IReadOnlyList<INodeViewModel<TModel>>> ModelsAsync<TModel>(IRedaktContext context, IEnumerable<string> nodeIds, Func<TModel, bool> filter, Nullable<CultureInfo> forCulture)
Returns:
ValueTask<IReadOnlyList<INodeViewModel<TModel>>>

Parameters

The current IRedaktContext.

nodeIds IEnumerable<string>

The node ids to get the view models for.

filter Func<TModel, bool>
forCulture Nullable<CultureInfo>

The culture for the nodes, or null to use the current request culture.

Type Parameters

TModel

The view model type. Must implement IContentType.

ModelsAsync<TModel>(IRedaktContext, IEnumerable<Link>, Func<TModel, bool>, Nullable<CultureInfo>)

Gets a list of view models for the specified node ids and culture. Only returns models for content that can be cast to TModel.

public static async ValueTask<IReadOnlyList<INodeViewModel<TModel>>> ModelsAsync<TModel>(IRedaktContext context, IEnumerable<Link> links, Func<TModel, bool> filter, Nullable<CultureInfo> forCulture)
Returns:
ValueTask<IReadOnlyList<INodeViewModel<TModel>>>

Parameters

The current IRedaktContext.

links IEnumerable<Link>

The links to get the view models for.

filter Func<TModel, bool>
forCulture Nullable<CultureInfo>

The culture for the nodes, or null to use the current request culture.

Type Parameters

TModel

The view model type. Must implement IContentType.

ModelsAsync<TModel>(IRedaktContext, IEnumerable<IPublishedContent>, Func<TModel, bool>)

Gets a list of view models for the specified published content objects. Only returns models for content that can be cast to TModel.

public static async ValueTask<IReadOnlyList<INodeViewModel<TModel>>> ModelsAsync<TModel>(IRedaktContext context, IEnumerable<IPublishedContent> publishedContent, Func<TModel, bool> filter)
Returns:
ValueTask<IReadOnlyList<INodeViewModel<TModel>>>

Parameters

The current IRedaktContext.

publishedContent IEnumerable<IPublishedContent>

Collection of published content objects to get the view models for.

filter Func<TModel, bool>

Type Parameters

TModel

The view model type. Must implement IContentType.

In this article