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
GetLedger(OrderLineViewModel)
Builds ledger values for the specified order line.
public static LedgerViewModel? GetLedger(this OrderLineViewModel orderLine)
Parameters
orderLineOrderLineViewModelThe order line view model.
Returns
- LedgerViewModel
A ledger view model, or null when the underlying order line cannot be resolved.
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.
TryGetLedger(OrderLineViewModel, out LedgerViewModel?)
Tries to build ledger values for the specified order line.
public static bool TryGetLedger(this OrderLineViewModel orderLine, out LedgerViewModel? ledger)
Parameters
orderLineOrderLineViewModelThe order line view model.
ledgerLedgerViewModelThe resolved ledger view model when available.
Returns
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.