Unverified Commit 96a69a67 authored by Daniel Roth's avatar Daniel Roth Committed by GitHub
Browse files

Add Order.GetTotalPrice() helper (#22)

parent 9333fbd5
......@@ -23,7 +23,7 @@
Items:
<strong>@item.Order.Pizzas.Count()</strong>;
Total price:
<strong>£@item.Order.Pizzas.Sum(p => p.GetTotalPrice()).ToString("0.00")</strong>
<strong>£@item.Order.GetTotalPrice().ToString("0.00")</strong>
</div>
<div class="col">
Status: <strong>@item.StatusText</strong>
......
......@@ -48,7 +48,7 @@
<p>
<strong>
Total price:
£@orderWithStatus.Order.Pizzas.Sum(p => p.GetTotalPrice()).ToString("0.00")
£@orderWithStatus.Order.GetTotalPrice().ToString("0.00")
</strong>
</p>
</div>
......
using System;
using System.Collections.Generic;
using System.Linq;
namespace BlazingPizza
{
......@@ -14,5 +15,7 @@ namespace BlazingPizza
public LatLong DeliveryLocation { get; set; }
public List<Pizza> Pizzas { get; set; }
public decimal GetTotalPrice() => Pizzas.Sum(p => p.GetTotalPrice());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment