Table of Contents

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

model FieldValueViewModel

The 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

model FieldValueViewModel

The field value model.

Returns

FileViewModel

The file model if the field value type is a file, otherwise null.

Gets the link model.

public static LinkViewModel? GetLink(this FieldValueViewModel model)

Parameters

model FieldValueViewModel

The 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

model FieldValueViewModel

The 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

model FieldValueViewModel

The 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

model FieldValueViewModel

The field value model.

Returns

bool

true if the field value is a color, otherwise false.

IsFile(FieldValueViewModel)

Gets value indicated if the field value is file

public static bool IsFile(this FieldValueViewModel model)

Parameters

model FieldValueViewModel

The field value model.

Returns

bool

true if the field value is a file, otherwise false.

Gets value indicated if the field value is link

public static bool IsLink(this FieldValueViewModel model)

Parameters

model FieldValueViewModel

The field value model.

Returns

bool

true if the field value is a link, otherwise false.

IsList(FieldValueViewModel)

Gets value indicated if the field value is list

public static bool IsList(this FieldValueViewModel model)

Parameters

model FieldValueViewModel

The field value model.

Returns

bool

true if the field value is a list, otherwise false.

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

groupFields IList<FieldValueViewModel>

The collection of field values.

systemName string

The field system name.

field FieldValueViewModel

When this method returns, contains the field, if the field exists, otherwise null.

Returns

bool

true if field is not null, otherwise false

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

groupFields IList<FieldValueViewModel>

The collection of field values.

systemName string

The field system name.

value string

When this method returns, contains the correct image path, if the field exists, otherwise string.Empty.

Returns

bool

true if value is not null and not empty, otherwise false

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

groupFields IList<FieldValueViewModel>

The collection of field values.

systemName string

The field system name.

value string

When this method returns, contains the stringified field value, if the field exists, otherwise string.Empty.

Returns

bool

true if value is not null and not empty, otherwise false

Remarks

This method uses the TryGetField(IList<FieldValueViewModel>, string, out FieldValueViewModel?) method to retrieve the value of the field.

To top