public virtual Money Calculate(IWashProgram program, Currency currency) { Money totalPrice = program .GetWashSteps() .Select(x => x.Price) .Aggregate((x, y) => x + y); return converter.Convert(totalPrice, currency); }
public virtual string Build() { var builder = new StringBuilder(); builder.AppendLine($"Recepient: {_invoice.Recepient}"); builder.AppendLine($"Program type: {_invoice.WashProgram.Name}"); builder.AppendLine("-----------------------------"); foreach (var washStep in _invoice.WashProgram.GetWashSteps()) { builder.AppendLine($" * {washStep.GetDescription()} - {_converter.Convert(washStep.Price, _currency)}"); } builder.AppendLine("-----------------------------"); builder.AppendLine($"Total price: {_invoice.Price}"); builder.AppendLine($"Discount: {_discount}%"); return(builder.ToString()); }