// 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()); }
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()); }
//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) }); }
// 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 }); }
// 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 }); }
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 }); }
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); }