public View.Device Build(Model.Device device) { return(new View.Device { DeviceGuid = device.DeviceGuid, DeviceName = device.DeviceName, Inventory = device.Inventory == null ? null : inventoryViewBuilder.Build(device.Inventory), Organization = device.Organization == null ? null : organizationViewBuilder.Build(device.Organization), CreatedOn = device.CreatedOn.ToString(), UpdatedOn = device.UpdatedOn.ToString() }); }
public View.Inventory Build(Model.Inventory inventory) { List <View.InventoryItem> inventoryItems = new List <View.InventoryItem>(); if (inventory.InventoryItems != null) { inventoryItems = inventory.InventoryItems.Select(x => inventoryItemViewBuilder.Build(x)).ToList(); } return(new View.Inventory { InventoryGuid = inventory.InventoryGuid, Organization = inventory.Organization == null ? null : organizationViewBuilder.Build(inventory.Organization), InventoryItems = inventoryItems, CreatedOn = inventory.CreatedOn.ToString(), UpdatedOn = inventory.UpdatedOn.ToString() }); }