Пример #1
0
 // Maps a collection of SalesOrderItems (data) to SalesOrderItemModels (view models)
 private static List <SalesOrderItemModel> SerializeSalesOrderItems(IEnumerable <SalesOrderItem> orderItems)
 {
     return(orderItems.Select(item => new SalesOrderItemModel {
         Id = item.Id,
         Quantity = item.Quantity,
         Product = ProductMapper.SerializeProductModel(item.Product)
     }).ToList());
 }
Пример #2
0
 public static List <SalesOrderItemViewModel> SerializeSalesOrderItems(IEnumerable <SalesOrderItem> salesOrderItems)
 {
     return(salesOrderItems.Select(x => new SalesOrderItemViewModel
     {
         Id = x.Id,
         Quantity = x.Quantity,
         Product = ProductMapper.SerializeProductModel(x.Product)
     }).ToList());
 }
Пример #3
0
 //Serializes an inventoryVM to an inventory data model
 public static ProductInventory SerializeInventory(InventoryViewModel inventory)
 {
     return(new ProductInventory
     {
         Id = inventory.Id,
         CreatedOn = inventory.CreatedOn,
         UpdatedOn = inventory.UpdatedOn,
         QuantityOnHand = inventory.QuantityOnHand,
         IdealQuantity = inventory.IdealQuantity,
         InventoryProduct = ProductMapper.SerializeProductViewModel(inventory.InventoryProduct)
     });
 }
Пример #4
0
        // Maps an InvoiceModel view model to a SalesOrder data model
        public static SalesOrder SerializeInvoiceToOrder(InvoiceModel invoice)
        {
            var salesOrderItems = invoice.LineItems
                                  .Select(item => new SalesOrderItem {
                Id       = item.Id,
                Quantity = item.Id,
                Product  = ProductMapper.SerializeProductModel(item.Product)
            }).ToList();

            return(new SalesOrder {
                SalesOrderItem = salesOrderItems,
                CreatedOn = DateTime.UtcNow,
                UpdatedOn = DateTime.UtcNow
            });
        }
Пример #5
0
        // Maps an InvoiceVM to a SalesOrder data model
        public static SalesOrder SerializeInvoiceToOrder(InvoiceViewModel order)
        {
            var salesOrderItems = order.LineItems
                                  .Select(item => new SalesOrderItem
            {
                Id               = item.Id,
                Quantity         = item.Quantity,
                InventoryProduct = ProductMapper.SerializeProductViewModel(item.InventoryProduct)
            }).ToList();

            return(new SalesOrder
            {
                SalesOrderItems = salesOrderItems,
                CreatedOn = order.CreatedOn,
                UpdatedOn = order.UpdatedOn
            });
        }
Пример #6
0
        public static SalesOrder SeralizeInvoiceToOrder(InvoiceViewModel invoice)
        {
            var salesOrderItems = invoice.LineItems
                                  .Select(x => new SalesOrderItem
            {
                Id       = x.Id,
                Quantity = x.Quantity,
                Product  = ProductMapper.SerializeProductModel(x.Product)
            }).ToList();

            return(new SalesOrder
            {
                SalesOrderItems = salesOrderItems,
                CreatedDate = DateTime.Now,
                UpdatedDate = DateTime.Now
            });
        }
Пример #7
0
        public static List <ProductInventoryViewModel> SerializeInventory(List <ProductInventory> productInventoryList)
        {
            var viewModel = new List <ProductInventoryViewModel>();

            foreach (var productInventory in productInventoryList)
            {
                viewModel.Add(new ProductInventoryViewModel
                {
                    Id             = productInventory.Id,
                    IdealQuantity  = productInventory.IdealQuantity,
                    Product        = ProductMapper.SerializeProductModel(productInventory.Product),
                    QuantityOnHand = productInventory.QuantityOnHand
                });
            }

            return(viewModel);
        }