Class UserGroupListViewModel
- Namespace
- Dynamicweb.Users.Frontend.UserGroups
- Assembly
- Dynamicweb.Users.dll
View model for the UserGroup list template.
public sealed class UserGroupListViewModel : ViewModelBase
- Inheritance
-
UserGroupListViewModel
- Inherited Members
Examples
Razor list template usage:
@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserGroups.UserGroupListViewModel> @using Dynamicweb.Users.Frontend.UserGroups
@if (Model.Groups?.Any() == true) { <ul class="user-groups"> @foreach (var g in Model.Groups) { <li>@g.Name</li> } </ul> } else { <p>No user groups found.</p> }
@if (Model.PageCount > 1) { <nav class="pagination"> Page @Model.CurrentPage of @Model.PageCount (Total: @Model.TotalCount) </nav> }
@if (Model.Result != UserGroupResultType.None) { <p class="form-message">@Translate(Model.Result.ToString())</p> }
Remarks
This model is provided to Razor templates in /Templates/Users/UserGroup/List.
It contains the current page of user groups to display, paging metadata, and the result of the
most recent group-related operation.
Templates usually iterate over Groups to render a list or table of user groups. Paging information is available via CurrentPage, PageCount, PageSize, and TotalCount.
The Result property can be used to display feedback messages after actions such as creating, updating, or deleting a user group.
Properties
CurrentPage
Gets or sets the current page number being displayed.
public int CurrentPage { get; set; }
Property Value
- int
The current page number (1-based index).
Groups
Gets or sets the collection of user group view models to be displayed.
public IEnumerable<UserGroupViewModel> Groups { get; set; }
Property Value
- IEnumerable<UserGroupViewModel>
An IEnumerable<T> containing the user groups.
PageCount
Gets or sets the total number of pages available for the current group list. If this value is greater than 0, the view model result will be paginated; otherwise, a plain list is shown.
public int PageCount { get; set; }
Property Value
- int
The total number of pages.
PageSize
Gets or sets the number of groups to display per page.
public int PageSize { get; set; }
Property Value
- int
The number of groups per page.
Result
Gets or sets the result type of the user group operation, indicating the outcome of the operation.
public UserGroupResultType Result { get; set; }
Property Value
- UserGroupResultType
A UserGroupResultType value representing the result.
TotalCount
Gets or sets the total number of user groups in the list (across all pages).
public int TotalCount { get; set; }
Property Value
- int
The total count of user groups.