Class UserGroupViewModelExtensions
- Namespace
- Dynamicweb.Frontend
- Assembly
- Dynamicweb.dll
public static class UserGroupViewModelExtensions
- Inheritance
-
UserGroupViewModelExtensions
- Inherited Members
Methods
GetTwoLetterInitials(UserGroupViewModel)
Generates a two-letter uppercase initial string based on the group's name information.
public static string? GetTwoLetterInitials(this UserGroupViewModel model)
Parameters
modelUserGroupViewModelThe UserGroupViewModel instance containing name data.
Returns
- string
A two-character string representing the group's initials:
-
If
Nameis provided and contains two words, the first character of each word is used. -
If
Nameis a single word with at least two characters, the first two characters are used. -
If
Nameis a single character, that character is used followed by 'X'. -
If no name data is available, returns
NN.
All letters are returned in uppercase and invariant to culture.
-
If
Examples
For Name = "Dynamic Web", returns "DW".
For Name = "Dynamicweb", returns "DY".
For Name = "D", returns "DX".
For empty input, returns NN.
GetUsers(UserGroupViewModel, int, int)
Gets a list of users that belong to the group.
public static IEnumerable<UserViewModel> GetUsers(this UserGroupViewModel viewModel, int pageIndex = 0, int pageSize = 12)
Parameters
viewModelUserGroupViewModelThe user group view model.
pageIndexintThe zero-based index of a page.
pageSizeintThe count of users per page.
Returns
- IEnumerable<UserViewModel>
A collection of UserViewModel.
TryGetImageFile(UserGroupViewModel, out ImageFileViewModel?)
Tries to get the ImageFileViewModel for the Image.
public static bool TryGetImageFile(this UserGroupViewModel viewModel, out ImageFileViewModel? image)
Parameters
viewModelUserGroupViewModelThe user group view model.
imageImageFileViewModelWhen this method returns
true, it contains the ImageFileViewModel object, otherwisenull.