Beispiel #1
0
    public static Order CreateFrom(XElement invoice)
    {
        string time = (string)invoice.Element("time");
        string date = (string)invoice.Element("date");

        return(new Order {
            Id = (int)invoice.Element("order_id"),
            Date = DateTime.ParseExact(date + time, "dd-MM-yyyyhh:mm tt", null),
            Items = invoice.Element("order")
                    .Elements("item")
                    .Select(i => OrderItem.CreateFrom(i))
                    .ToList()
        });
    }