예제 #1
0
        public string GenerateReceipt()
        {
            var orderLines = order.GetOrder().ToList();
            var result     = new StringBuilder($"Order receipt for '{order.Company}'{Environment.NewLine}");

            foreach (var line in orderLines)
            {
                result.AppendLine(
                    $"\t{line.Quantity} x {line.Product.ProductType} {line.Product.ProductName} = {line.PriceForOrderLine():C}");
            }

            result.AppendLine($"Subtotal: {order.TotalAmount():C}");
            result.AppendLine($"MVA: {order.TotalTax:C}");
            result.Append($"Total: {(order.TotalAmount() + order.TotalTax):C}");
            return(result.ToString());
        }