Пример #1
0
        public InventoryBusinessModel Map(Inventory source)
        {
            if (source == null)
            {
                return(null);
            }

            InventoryBusinessModel inventoryBusinessModel = new InventoryBusinessModel
            {
                InventoryId  = source.InventoryId,
                Number       = source.Number,
                IsAvailable  = source.IsAvailable,
                WriteOffDate = source.WriteOffDate
            };

            ConsignmentMapper consignmentMapper = new ConsignmentMapper();

            inventoryBusinessModel.Consignment = consignmentMapper.Map(source.Consignment);

            var itemMapper = new ItemMapper();

            inventoryBusinessModel.Item = itemMapper.Map(source.Item);

            return(inventoryBusinessModel);
        }
Пример #2
0
        public Inventory Map(InventoryBusinessModel source)
        {
            if (source == null)
            {
                return(null);
            }

            Inventory inventory = new Inventory
            {
                InventoryId  = source.InventoryId,
                Number       = source.Number,
                IsAvailable  = source.IsAvailable,
                WriteOffDate = source.WriteOffDate
            };

            var itemMapper = new ItemMapper();

            inventory.Item = itemMapper.Map(source.Item);

            return(inventory);
        }
Пример #3
0
        public Consignment Map(ConsignmentBusinessModel source)
        {
            if (source == null)
            {
                return(null);
            }

            Consignment consignment = new Consignment
            {
                Id           = source.Id,
                ArrivalDate  = source.ArrivalDate,
                WriteOffDate = source.WriteOffDate
            };

            if (source.Item != null)
            {
                var itemMapper = new ItemMapper();
                consignment.Item = itemMapper.Map(source.Item);
            }

            return(consignment);
        }
Пример #4
0
        public ConsignmentBusinessModel Map(Consignment source)
        {
            if (source == null)
            {
                return(null);
            }

            ConsignmentBusinessModel consignment = new ConsignmentBusinessModel
            {
                Id           = source.Id,
                Number       = source.Number,
                ArrivalDate  = source.ArrivalDate,
                WriteOffDate = source.WriteOffDate
            };

            if (source.Inventories != null)
            {
                var inventoryMapper = new InventoryMapper();
                consignment.Inventories =
                    source.Inventories.Select(
                        a =>
                        inventoryMapper.Map(
                            new Inventory
                {
                    InventoryId  = a.InventoryId,
                    IsAvailable  = a.IsAvailable,
                    Number       = a.Number,
                    WriteOffDate = a.WriteOffDate
                })).ToList();
            }
            if (source.Item != null)
            {
                var itemMapper = new ItemMapper();
                consignment.Item = itemMapper.Map(source.Item);
            }

            return(consignment);
        }