Skip to content

Instantly share code, notes, and snippets.

@kasunkv
Created May 7, 2019 15:51
Show Gist options
  • Save kasunkv/d2fa1c85437b3ca3a604d507f23f0c1e to your computer and use it in GitHub Desktop.
Save kasunkv/d2fa1c85437b3ca3a604d507f23f0c1e to your computer and use it in GitHub Desktop.
ProcessDiscount() method
public (double, List<string>) ProcessDiscount(OrderViewModel order)
{
var discountDiscroptoons = new List<string>();
var totalDiscount = 0.0;
foreach (var discount in _discounts)
{
var addedDiscount = discount.CalculateDiscount(order);
if (addedDiscount > 0)
{
discountDiscroptoons.Add(discount.Description);
}
totalDiscount += addedDiscount;
}
return (totalDiscount, discountDiscroptoons);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment