Пример #1
0
 private static List <OrderItemViewModel> SerializeSalesOrderItems(IEnumerable <OrderItem> orderItems)
 {
     return(orderItems.Select(item => new OrderItemViewModel
     {
         Id = item.Id,
         Quantity = item.Quantity,
         Product = ProductMapping.SerializeProductModel(item.Product)
     }).ToList());
 }
Пример #2
0
        public static Order SerializeInvoiceToOrder(InvoiceViewModel invoice)
        {
            var orderItems = invoice.Items
                             .Select(item => new OrderItem
            {
                Id       = item.Id,
                Quantity = item.Quantity,
                Product  = ProductMapping.SerializeProductModel(item.Product)
            }).ToList();

            return(new Order
            {
                OrderItems = orderItems,
                DateCreated = DateTime.UtcNow,
                DateUpdated = DateTime.UtcNow
            });
        }