refactoring

vnext
Paul Schneider 7 years ago
parent 95a417fa6e
commit aa31861e51
3 changed files with 5 additions and 18 deletions

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Yavsc.Billing;
using Yavsc.Models.Billing;
namespace Yavsc.Helpers
{
@ -8,5 +9,7 @@ namespace Yavsc.Helpers
{
public static decimal Addition(this List<IBillItem> items) => items.Aggregate<IBillItem, decimal>(0m, (t, l) => t + l.Count * l.UnitaryCost);
public static decimal Addition(this List<CommandLine> items) => items.Select(i=>((IBillItem)i)).ToList().Addition();
}
}

@ -1,16 +0,0 @@
using Yavsc.Models.Billing;
namespace Yavsc.Helpers
{
public static class EstimateHelpers {
public static decimal GetTotal(this Estimate estimate)
{
decimal result = 0;
foreach (var l in estimate.Bill)
result += l.Count*l.UnitaryCost;
return result;
}
}
}

@ -28,7 +28,7 @@ namespace Yavsc.Models.Messaging
};
Sender = perfer.Performer.UserName;
Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName,
estimate.Title,estimate.GetTotal());
estimate.Title,estimate.Bill.Addition());
}
ProviderClientInfo ProviderInfo { get; set; }
Estimate Estimation { get; set; }

Loading…