I have a class Places that have the elements building, room, shelf and box.
It looks like
<table>
<thead>
<tr>
<th align="center">BUILDING</th>
<th align="center">ROOM</th>
<th align="center">SHELF</th>
<th align="center">BOX</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">House1</td>
<td align="center">100</td>
<td align="center">1</td>
<td align="center">A</td>
<td align="center">House1</td>
<td align="center">100</td>
<td align="center">1</td>
<td align="center">B</td>
<td align="center">House1</td>
<td align="center">100</td>
<td align="center">1</td>
<td align="center">C</td>
<td align="center">House2</td>
<td align="center">101</td>
<td align="center">2</td>
<td align="center">B</td>
</tr>
</tbody>
</table>
At the moment I have the problem, if I select building and a room (e.g. House1, 100), my combobox for the shelf is showing shelf "1" for three times.
List<Places> lstPlaces = new List<Places>();
IEnumerable<Places> lst = AllShelfAndBoxes();
foreach (var item in lst)
{
if (item.Building == str_Building && item.Room == str_Room)
lstPlaces.Add(item);
}
....
So what do I have to do, that the shelf is added only one time - and not for every building and room?
At that point it is not necessary to add the building and room to the list. But I need a List<Places> to return and not a List<string>.
Hope you understand my problem? Kind regards.