Class FieldValueViewModelExtensionMethods
- Namespace
- Dynamicweb.Ecommerce.ProductCatalog
- Assembly
- Dynamicweb.Ecommerce.dll
Provides extension methods for the FieldValueViewModel class.
public static class FieldValueViewModelExtensionMethods
- Inheritance
-
FieldValueViewModelExtensionMethods
- Inherited Members
Methods
GetColor(FieldValueViewModel)
Gets the color model.
public static ColorViewModel? GetColor(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- ColorViewModel
The color model if the field value type is a color, otherwise
null.
GetFile(FieldValueViewModel)
Gets the file model.
public static FileViewModel? GetFile(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- FileViewModel
The file model if the field value type is a file, otherwise
null.
GetLink(FieldValueViewModel)
Gets the link model.
public static LinkViewModel? GetLink(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- LinkViewModel
The link model if the field value type is a link, otherwise
null.
GetList(FieldValueViewModel)
Gets the list model.
public static List<FieldOptionValueViewModel> GetList(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- List<FieldOptionValueViewModel>
The list model if the field value type is a list, otherwise an empty list.
GetValueWithUnits(FieldValueViewModel)
Returns the string representation of model
public static string? GetValueWithUnits(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- string
The string representation of the model.
IsColor(FieldValueViewModel)
Gets value indicated if the field value is color
public static bool IsColor(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- bool
trueif the field value is a color, otherwisefalse.
IsFile(FieldValueViewModel)
Gets value indicated if the field value is file
public static bool IsFile(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- bool
trueif the field value is a file, otherwisefalse.
IsLink(FieldValueViewModel)
Gets value indicated if the field value is link
public static bool IsLink(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- bool
trueif the field value is a link, otherwisefalse.
IsList(FieldValueViewModel)
Gets value indicated if the field value is list
public static bool IsList(this FieldValueViewModel model)
Parameters
modelFieldValueViewModelThe field value model.
Returns
- bool
trueif the field value is a list, otherwisefalse.
TryGetField(IList<FieldValueViewModel>, string, out FieldValueViewModel?)
Returns true if the field is found and assigned to the passed out parameter.
public static bool TryGetField(this IList<FieldValueViewModel> groupFields, string systemName, out FieldValueViewModel? field)
Parameters
groupFieldsIList<FieldValueViewModel>The collection of field values.
systemNamestringThe field system name.
fieldFieldValueViewModelWhen this method returns, contains the field, if the field exists, otherwise
null.
Returns
- bool
trueiffieldis not null, otherwisefalse
TryGetImagePath(IList<FieldValueViewModel>, string, out string?)
Returns true if the value of the field is specified and assigned to the passed out parameter.
public static bool TryGetImagePath(this IList<FieldValueViewModel> groupFields, string systemName, out string? value)
Parameters
groupFieldsIList<FieldValueViewModel>The collection of field values.
systemNamestringThe field system name.
valuestringWhen this method returns, contains the correct image path, if the field exists, otherwise
string.Empty.
Returns
- bool
trueifvalueis not null and not empty, otherwisefalse
Remarks
This method uses the TryGetString(IList<FieldValueViewModel>, string, out string?) method to retrieve the value of the field.
TryGetString(IList<FieldValueViewModel>, string, out string?)
Returns true if the value of the field is specified and assigned to the passed out parameter.
public static bool TryGetString(this IList<FieldValueViewModel> groupFields, string systemName, out string? value)
Parameters
groupFieldsIList<FieldValueViewModel>The collection of field values.
systemNamestringThe field system name.
valuestringWhen this method returns, contains the stringified field value, if the field exists, otherwise
string.Empty.
Returns
- bool
trueifvalueis not null and not empty, otherwisefalse
Remarks
This method uses the TryGetField(IList<FieldValueViewModel>, string, out FieldValueViewModel?) method to retrieve the value of the field.