public static IEnumerable <AssetDetail> CreateAssetDetails(IEnumerable <AssetReservationResult> testAssets) { List <AssetDetail> assetDetails = new List <AssetDetail>(); List <string> assetIds = testAssets.Select(n => n.AssetId).ToList(); using (AssetInventoryContext context = DbConnect.AssetInventoryContext()) { List <Asset> assets = context.Assets.Where(n => assetIds.Contains(n.AssetId)).ToList(); foreach (Asset asset in assets) { AssetReservationResult testAsset = testAssets.First(n => n.AssetId == asset.AssetId); AssetDetail assetDetail = CreateAssetDetail(asset, testAsset); assetDetail.Description = asset.ToAssetInfo().Description; assetDetails.Add(assetDetail); } List <BadgeBox> badgeBoxes = context.BadgeBoxes.Where(n => assetIds.Contains(n.PrinterId)).ToList(); foreach (BadgeBox badgeBox in badgeBoxes) { assetDetails.Add(CreateBadgeBoxDetail(badgeBox)); } } return(assetDetails); }
public AssetAvailabilityInfo(AssetDetail detail) { AssetId = detail.AssetId; Availability = detail.Availability; AvailabilityEndTime = detail.AvailabilityEndTime; }