ModelAsync<TModel>(IRedaktContext, string, Nullable<CultureInfo>)
Gets the view model for the specified node id and culture. Returns null if the content model cannot be cast to TModel
.
public static async ValueTask<INodeViewModel<TModel>> ModelAsync<TModel>(IRedaktContext context, string nodeId, Nullable<CultureInfo> forCulture)
- Returns:
- ValueTask<INodeViewModel<TModel>>
Parameters
The current IRedaktContext.
The node id to get the view model for.
The culture for the page, or null to use the current request culture.
Type Parameters
The view model type. Must implement IContentType.
ModelAsync<TModel>(IRedaktContext, Link, Nullable<CultureInfo>)
Gets the view model for the specified link and culture. Returns null if the content model cannot be cast to TModel
.
public static async ValueTask<INodeViewModel<TModel>> ModelAsync<TModel>(IRedaktContext context, Link link, Nullable<CultureInfo> forCulture)
- Returns:
- ValueTask<INodeViewModel<TModel>>
Parameters
The current IRedaktContext.
The link object to get the view model for.
The culture for the page, or null to use the current request culture.
Type Parameters
The view model type. Must implement IContentType.
ModelAsync<TModel>(IRedaktContext, IPublishedContent)
Gets the view model for the specified published content object. Returns null if the content model cannot be cast to TModel
.
public static async ValueTask<INodeViewModel<TModel>> ModelAsync<TModel>(IRedaktContext context, IPublishedContent publishedContent)
- Returns:
- ValueTask<INodeViewModel<TModel>>
Parameters
The current IRedaktContext.
The published content object to get the view model for.
Type Parameters
The view model type. Must implement IContentType.