Пример #1
0
        private void UpdatePrices(double shippingCost)
        {
            var currencyFormatter = new CurrencyFormatter(_order.ShoppingCart.Currency);

            OrderSubtotal = currencyFormatter.FormatDouble(Math.Round(_order.ShoppingCart.TotalPrice, 2));
            ShippingCost  = currencyFormatter.FormatDouble(shippingCost);

            var taxCost = Math.Round((_order.ShoppingCart.TotalPrice + shippingCost) * _order.ShoppingCart.TaxRate, 2);

            TaxCost = currencyFormatter.FormatDouble(taxCost);

            var grandTotal = Math.Round(_order.ShoppingCart.TotalPrice + shippingCost + taxCost, 2);

            GrandTotal = currencyFormatter.FormatDouble(grandTotal);
        }
 public string FormatDouble(double value) => _formatter.FormatDouble(value);