Hello,
How to convert currency to Int or float format in _ProductTierPrices.cshtml? not the source file.
i.e. convert "$100.00" to "100.00"
Z
@foreach (var tierPrice in Model.TierPrices)
{
var tirepriceStr = tierPrice.Price.Replace("$", "");
var tirepriceValue = Convert.ToDecimal(tirepriceStr);
var subtractedPrice = Convert.ToDecimal(Model.ProductPrice.PriceValue - tirepriceValue);
var calulatedPercentage = (subtractedPrice / Model.ProductPrice.PriceValue) * 100;
<td class="item-price">
@*@tierPrice.Price*@
@calulatedPercentage.ToString("0.##")% OFF
</td>
}
@foreach (var tierPrice in Model.TierPrices)
{
var tirepriceStr = tierPrice.Price.Replace("$", "");
var tirepriceValue = Convert.ToDecimal(tirepriceStr);
var subtractedPrice = Convert.ToDecimal(Model.ProductPrice.PriceValue - tirepriceValue);
var calulatedPercentage = (subtractedPrice / Model.ProductPrice.PriceValue) * 100;
<td class="item-price">
@*@tierPrice.Price*@
@calulatedPercentage.ToString("0.##")% OFF
</td>
}