コード例 #1
0
 /// <summary>
 /// Maps a collection of SalesOrderItems to SalesOrderItemModels
 /// </summary>
 /// <param name="orderItems"></param>
 /// <returns></returns>
 public static List <SalesOrderItemModel> SerialiseSalesOrderItems(IEnumerable <SalesOrderItem> orderItems)
 {
     return(orderItems.Select(item => new SalesOrderItemModel
     {
         Id = item.Id,
         Quantity = item.Quantity,
         Product = ProductMapper.SerialiseProductModel(item.Product)
     }).ToList());
 }
コード例 #2
0
        /// <summary>
        /// Maps an InvoiceModel to a salesorder data model
        /// </summary>
        /// <param name="invoice"></param>
        /// <returns></returns>
        public static SalesOrder SerialiseInvoiceToOrder(InvoiceModel invoice)
        {
            var salesOrderItems = invoice.LineItems
                                  .Select(item => new SalesOrderItem
            {
                Id       = item.Id,
                Quantity = item.Quantity,
                Product  = ProductMapper.SerialiseProductModel(item.Product)
            })
                                  .ToList();

            return(new SalesOrder
            {
                SalesOrderItems = salesOrderItems,
                UpdatedOn = DateTime.UtcNow,
                CreatedOn = DateTime.UtcNow
            });
        }