public void FillInventoryList() { InventoryViewModels.Clear(); AllProducts = new List <InventoryProductDto>(); var inventorys = _restApiClient.GetInventorysBySearchId(new RestApi.Client.Dto.Request.Inventory.GetInventoryBySearch { SearchId = SelectedInventorySearchId }); foreach (var inventory in inventorys) { InventoryViewModels.Add(new InventoryViewModel { Description = inventory.Description, EndDate = inventory.EndDate, Id = inventory.Id, InventoryStatus = inventory.InventorySatus.Description, StartDate = inventory.StartDate, ZoneName = AvailableZones.First(x => x.Id == inventory.Id).Description }); } AllProducts = inventorys.SelectMany(x => x.Products).ToList(); }