This repository has been archived on 2021-04-30. You can view files and clone it, but cannot push or open issues or pull requests.
blazing-workshop/BlazingPizza.Shared/Order.cs
2020-12-17 16:52:43 +01:00

26 lines
629 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace BlazingPizza
{
public class Order
{
public int OrderId { get; set; }
public string UserId { get; set; }
public DateTime CreatedTime { get; set; }
public Address DeliveryAddress { get; set; } = new Address();
public LatLong DeliveryLocation { get; set; }
public List<Pizza> Pizzas { get; set; } = new List<Pizza>();
public decimal GetTotalPrice() => Pizzas.Sum(p => p.GetTotalPrice());
public string GetFormattedTotalPrice() => GetTotalPrice().ToString("0.00");
}
}