Class OrderLineViewModelExtensions
- Namespace
- Dynamicweb.Ecommerce.Frontend
- Assembly
- Dynamicweb.Ecommerce.dll
Provides extension methods for the OrderLineViewModel and CartOrderlineViewModel classes.
public static class OrderLineViewModelExtensions
- Inheritance
-
OrderLineViewModelExtensions
- Inherited Members
Methods
GetProduct(OrderLineViewModel)
Retrieves the ProductViewModel associated with the specified OrderLineViewModel.
public static ProductViewModel? GetProduct(this OrderLineViewModel orderLine)
Parameters
orderLineOrderLineViewModelThe order line view model.
Returns
- ProductViewModel
A ProductViewModel if the product exists; otherwise, null.
GetProduct(CartOrderlineViewModel)
Retrieves the ProductViewModel associated with the specified CartOrderlineViewModel.
public static ProductViewModel? GetProduct(this CartOrderlineViewModel orderLine)
Parameters
orderLineCartOrderlineViewModelThe cart order line view model.
Returns
- ProductViewModel
A ProductViewModel if the product exists; otherwise, null.
HasProductDiscount(OrderLineViewModel)
Determines whether the order line has a discount (discount value > 0).
public static bool HasProductDiscount(this OrderLineViewModel orderLine)
Parameters
orderLineOrderLineViewModelThe order line view model.
Returns
- bool
True if a discount exists and its price value is greater than 0; otherwise false.
TryGetProductViewModel(OrderLineViewModel, out ProductViewModel?)
Tries to retrieve the ProductViewModel associated with the specified OrderLineViewModel.
public static bool TryGetProductViewModel(this OrderLineViewModel orderLine, out ProductViewModel? productViewModel)
Parameters
orderLineOrderLineViewModelThe order line view model.
productViewModelProductViewModelThe retrieved product view model if found; otherwise, null.
Returns
- bool
True if the product exists; otherwise, false.
TryGetProductViewModel(CartOrderlineViewModel, out ProductViewModel?)
Tries to retrieve the ProductViewModel associated with the specified CartOrderlineViewModel.
public static bool TryGetProductViewModel(this CartOrderlineViewModel orderLine, out ProductViewModel? productViewModel)
Parameters
orderLineCartOrderlineViewModelThe cart order line view model.
productViewModelProductViewModelThe retrieved product view model if found; otherwise, null.
Returns
- bool
True if the product exists; otherwise, false.