DataModelExtensions

Helper extensions for work with IDataModels.

Namespace:
Inetdev.AspNetCore
Type:
Class
Public:
Yes
Protected:
No
Sealed:
Yes
Abstract:
Yes
Inherits from:
System.Object

Methods

ToSelectListItemList

Converts a collection of IDataModels to a list of dropdown options.

Signature:
public List<SelectListItem> ToSelectListItemList(list, valuePropertyName, textPropertyName, addEmptyItem)
Returns

A list of SelectListItems.

Parameters
Name Type Summary
list IEnumerable<IDataModel> An IDataModel connection to convert.
valuePropertyName String The name of the property that contains the value.
textPropertyName String The name of the property that contains the text.
addEmptyItem Boolean true if an empty item must be added, otherwise false.
Exceptions
Type Summary
ArgumentNullException Thrown when list is null.

In this document