Commit 84e28c1f authored by Ryan Nowak's avatar Ryan Nowak
Browse files

Clean up other price formatting

parent d2adaee5
......@@ -23,7 +23,7 @@
Items:
<strong>@item.Order.Pizzas.Count()</strong>;
Total price:
<strong>£@item.Order.GetTotalPrice().ToString("0.00")</strong>
<strong>£@item.Order.GetFormattedTotalPrice()</strong>
</div>
<div class="col">
Status: <strong>@item.StatusText</strong>
......
......@@ -33,7 +33,7 @@
<strong>
@(Pizza.GetSizeInInches(pizza.Size))"
@pizza.Special.Name
(£@pizza.GetTotalPrice().ToString("0.00"))
(£@pizza.GetFormattedTotalPrice())
</strong>
</p>
......@@ -48,7 +48,7 @@
<p>
<strong>
Total price:
£@orderWithStatus.Order.GetTotalPrice().ToString("0.00")
£@orderWithStatus.Order.GetFormattedTotalPrice()
</strong>
</p>
</div>
......
......@@ -18,7 +18,7 @@
</label>
}
</div>
<label>£@(Pizza.GetBasePrice().ToString("0.00"))</label>
<label>£@(Pizza.GetFormattedTotalPrice())</label>
</div>
</div>
@if (AllToppings == null)
......@@ -43,7 +43,7 @@
<option value="-1" disabled selected>(select)</option>
@for (var i = 0; i < AllToppings.Count; i++)
{
<option value="@i">@AllToppings[i].Name - (£@(AllToppings[i].Price.ToString("0.00")))</option>
<option value="@i">@AllToppings[i].Name - (£@(AllToppings[i].GetFormattedPrice()))</option>
}
</select>
}
......@@ -60,7 +60,7 @@
{
<div class="topping">
@topping.Topping.Name
<span class="topping-price">@topping.Topping.Price.ToString("0.00")</span>
<span class="topping-price">@topping.Topping.GetFormattedPrice()</span>
<button type="button" class="delete-topping" onclick="@(() => RemoveTopping(topping.Topping))">x</button>
</div>
}
......@@ -70,7 +70,7 @@
<div class="dialog-buttons px-4">
<button class="btn btn-secondary mr-auto" onclick="@OnCancel">Cancel</button>
<span class="mr-center">
Price: <span class="price">@(Pizza.GetTotalPrice().ToString("0.00"))</span>
Price: <span class="price">@(Pizza.GetFormattedTotalPrice())</span>
</span>
<button class="btn btn-success ml-auto" onclick="@OnConfirm">Order ></button>
</div>
......
......@@ -8,7 +8,7 @@
}
</ul>
<div class="item-price">
@Pizza.GetTotalPrice().ToString("0.00")
@Pizza.GetFormattedTotalPrice()
</div>
</div>
......
......@@ -46,6 +46,11 @@ namespace BlazingPizza
return GetBasePrice() + Toppings.Sum(t => t.Topping.Price);
}
public string GetFormattedTotalPrice()
{
return GetTotalPrice().ToString("0.00");
}
public static int GetSizeInInches(PizzaSize size)
{
switch (size)
......
......@@ -7,5 +7,7 @@
public string Name { get; set; }
public decimal Price { get; set; }
public string GetFormattedPrice() => Price.ToString("0.00");
}
}
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