in src/ModernTacoShop/TrackOrder/src/Services/TrackOrderDynamoDbRecord.cs [24:46]
public Order ToOrder()
{
var result = new Order()
{
LastPosition = null,
LastUpdated = Timestamp.FromDateTime(LastUpdated.ToUniversalTime()),
OrderId = Id,
PlacedOn = Timestamp.FromDateTime(PlacedOn.ToUniversalTime()),
Status = System.Enum.Parse<OrderStatus>(Status),
};
// Create a Point for the last position if we have lat & long values.
if (!string.IsNullOrEmpty(LastPositionLatitude) && !string.IsNullOrEmpty(LastPositionLongitude))
{
result.LastPosition = new Point()
{
Latitude = LastPositionLatitude,
Longitude = LastPositionLongitude
};
}
return result;
}