Implemented all functions for BuildingInformation.cs
This commit is contained in:
parent
d2c41943f6
commit
e5d6fee9dc
1 changed files with 15 additions and 6 deletions
|
|
@ -22,8 +22,7 @@ public sealed class BuildingInformation
|
|||
/// Returns all floors in the building
|
||||
/// </summary>
|
||||
/// <returns>A list of available floors</returns>
|
||||
// TODO
|
||||
public List<Floor> GetFloorSelection() => new();
|
||||
public List<Floor> GetFloorSelection() => _companiesPerFloor.GetKeys();
|
||||
|
||||
/// <summary>
|
||||
/// Returns all companies residing on a specific floor.
|
||||
|
|
@ -31,8 +30,11 @@ public sealed class BuildingInformation
|
|||
/// </summary>
|
||||
/// <param name="floor">The floor to check</param>
|
||||
/// <returns>A list of names of companies residing on the provided floor</returns>
|
||||
// TODO
|
||||
public List<string>? GetCompaniesOnFloor(Floor floor) => null;
|
||||
public List<string>? GetCompaniesOnFloor(Floor floor)
|
||||
{
|
||||
_companiesPerFloor.TryGetValue(floor, out MyDictionary<string, Company>? companies);
|
||||
return companies?.GetKeys();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the company identified by floor and company name.
|
||||
|
|
@ -41,6 +43,13 @@ public sealed class BuildingInformation
|
|||
/// <param name="floor">Floor to look at</param>
|
||||
/// <param name="companyName">Name of the requested company</param>
|
||||
/// <returns>Company information if found; null otherwise</returns>
|
||||
// TODO
|
||||
public Company? GetCompany(Floor floor, string companyName) => null;
|
||||
public Company? GetCompany(Floor floor, string companyName)
|
||||
{
|
||||
//Needed to declare here, else you get an initialization error
|
||||
Company? company = null;
|
||||
|
||||
_companiesPerFloor.TryGetValue(floor, out MyDictionary<string, Company>? companies);
|
||||
companies?.TryGetValue(companyName, out company);
|
||||
return company;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue