Ejemplo n.º 1
0
 public static OrderDto AsDto(this OrderDocument document)
 => new OrderDto
 {
     Id           = document.Id,
     CustomerId   = document.CustomerId,
     VehicleId    = document.VehicleId,
     Status       = document.Status.ToString().ToLowerInvariant(),
     CreatedAt    = document.CreatedAt,
     DeliveryDate = document.DeliveryDate,
     TotalPrice   = document.TotalPrice,
     Parcels      = document.Parcels.Select(p => new ParcelDto
     {
         Id      = p.Id,
         Name    = p.Name,
         Size    = p.Size,
         Variant = p.Variant
     })
 };
Ejemplo n.º 2
0
 public static Order AsEntity(this OrderDocument document)
 => new Order(document.Id, document.CustomerId, document.Status, document.CreatedAt,
              document.Parcels.Select(p => new Parcel(p.Id, p.Name, p.Variant, p.Size)),
              document.VehicleId, document.DeliveryDate, document.TotalPrice);