refactoring the haircut messaging
This commit is contained in:
parent
ea5e1a37dd
commit
8ec60de3f3
12 changed files with 199 additions and 80 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Yavsc.Billing;
|
||||
using Yavsc.Models.Billing;
|
||||
|
|
@ -11,5 +12,11 @@ namespace Yavsc.Helpers
|
|||
|
||||
public static decimal Addition(this List<CommandLine> items) => items.Select(i=>((IBillItem)i)).ToList().Addition();
|
||||
|
||||
public static string GetBillText(this IBillable query) {
|
||||
string total = query.GetBillItems().Addition().ToString("C", CultureInfo.CurrentUICulture);
|
||||
string bill = string.Join("\n", query.GetBillItems().Select(l=> $"{l.Name} {l.Description} : {l.UnitaryCost} € " + ((l.Count != 1) ? "*"+l.Count.ToString() : ""))) +
|
||||
$"\n\nTotal: {total}";
|
||||
return bill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue