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
- Extension Methods
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.
When the request carries a ParentGroupId, Groups holds the subgroups of that
group, and ParentGroupId and Ancestors describe where in the hierarchy
the list sits.
Properties
Ancestors
Gets or sets the ancestor trail of the listed groups, ordered from the top-most (root) group down to and including the parent group. Empty when the top-level groups are listed. Used to build the breadcrumb trail.
public IEnumerable<UserGroupViewModel> Ancestors { get; set; }
Property Value
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.
ParentGroupId
Gets or sets the identifier of the group whose subgroups are listed.
public int ParentGroupId { get; set; }
Property Value
- int
The parent group id, or 0 when the top-level groups are listed.
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.