Class OrderExtensions
- Namespace
- Dynamicweb.Ecommerce.Frontend
- Assembly
- Dynamicweb.Ecommerce.dll
Provides extension methods for the Order class.
public static class OrderExtensions
- Inheritance
-
OrderExtensions
- Inherited Members
Methods
ToCartViewModel(Order)
Converts an Order to a CartViewModel.
public static CartViewModel ToCartViewModel(this Order order)
Parameters
orderOrderThe order to convert.
Returns
- CartViewModel
A CartViewModel representing the cart or
nulliforderis null.
Examples
CartViewModel? cartViewModel = Common.Context.Cart.ToCartViewModel();
Remarks
The CartViewModel is usually used for mini carts and information on cart content. The OrderViewModel returned by ToOrderViewModel(Order) is more comprehensive model with more information
ToOrderViewModel(Order)
Converts an Order to an OrderViewModel.
public static OrderViewModel ToOrderViewModel(this Order order)
Parameters
orderOrderThe order to convert.
Returns
- OrderViewModel
An OrderViewModel representing the order or
nulliforderis null.
Examples
OrderViewModel? orderViewModel = Common.Context.Cart.ToOrderViewModel();
TryGetCartViewModel(Order, out CartViewModel?)
Tries to get the CartViewModel from the specified Order.
public static bool TryGetCartViewModel(this Order order, out CartViewModel? cartViewModel)
Parameters
orderOrderThe order from which to retrieve the view model.
cartViewModelCartViewModelThe resulting CartViewModel if successful; otherwise,
null.
Returns
- bool
trueif the view model was successfully retrieved; otherwise,false.
TryGetOrderViewModel(Order, out OrderViewModel?)
Tries to get the OrderViewModel from the specified Order.
public static bool TryGetOrderViewModel(this Order order, out OrderViewModel? orderViewModel)
Parameters
orderOrderThe order from which to retrieve the view model.
orderViewModelOrderViewModelThe resulting OrderViewModel if successful; otherwise,
null.
Returns
- bool
trueif the view model was successfully retrieved; otherwise,false.