Table of Contents

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

model UserGroupViewModel

The UserGroupViewModel instance containing name data.

Returns

string

A two-character string representing the group's initials:

  • If Name is provided and contains two words, the first character of each word is used.
  • If Name is a single word with at least two characters, the first two characters are used.
  • If Name is 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.

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

viewModel UserGroupViewModel

The user group view model.

pageIndex int

The zero-based index of a page.

pageSize int

The 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

viewModel UserGroupViewModel

The user group view model.

image ImageFileViewModel

When this method returns true, it contains the ImageFileViewModel object, otherwise null.

Returns

bool

True if the Image has path and the associated file is exist, otherwise false.

To top