public static PriceModel GetPriceModel(this VariationContent currentContent, IMarket market) { PriceModel priceModel = new PriceModel(); priceModel.DefaultPrice = currentContent.GetPrice(market); priceModel.DiscountPrice = currentContent.GetDiscountPrice(market); priceModel.CustomerClubPrice = currentContent.GetCustomerClubPrice(market); return(priceModel); }
/// <summary> /// Gets the display price for the variation and market, including currency symbol. /// </summary> /// <param name="variation">The variation to retrieve price from.</param> /// <param name="market">The market to get price for. If null, the current market is used.</param> /// <returns></returns> public static string GetDisplayPrice(this VariationContent variation, IMarket market = null) { Price price = variation.GetPrice(market); return(price != null?price.UnitPrice.ToString() : string.Empty); }
public static int GetDefaultPriceAmountWholeNumber(this VariationContent variation, IMarket market) { Price price = variation.GetPrice(market); return(price != null?decimal.ToInt32(price.UnitPrice.Amount) : 0); }