mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 21:06:30 +02:00
Code updated to 3.0.238
This commit is contained in:
parent
3302d80678
commit
9c6a1fa92b
257 changed files with 7763 additions and 2861 deletions
|
@ -11,37 +11,37 @@ namespace TINK.Model.Bike
|
|||
public class BikeCollection : IBikeDictionary<BikeInfo>
|
||||
{
|
||||
/// <summary> Holds the bike dictionary object.</summary>
|
||||
private Dictionary<int, BikeInfo> BikeDictionary { get; }
|
||||
private Dictionary<string, BikeInfo> BikeDictionary { get; }
|
||||
|
||||
/// <summary>Constructs an empty bike info dictionary object.</summary>
|
||||
public BikeCollection()
|
||||
{
|
||||
BikeDictionary = new Dictionary<int, BikeInfo>();
|
||||
BikeDictionary = new Dictionary<string, BikeInfo>();
|
||||
}
|
||||
|
||||
/// <summary> Constructs a bike collection object.</summary>
|
||||
/// <param name="bikeDictionary"></param>
|
||||
public BikeCollection(Dictionary<int, BikeInfo> bikeDictionary)
|
||||
public BikeCollection(Dictionary<string, BikeInfo> bikeDictionary)
|
||||
{
|
||||
BikeDictionary = bikeDictionary ??
|
||||
throw new ArgumentNullException(nameof(bikeDictionary), "Can not construct BikeCollection object.");
|
||||
}
|
||||
|
||||
/// <summary> Gets a bike by its id.</summary>
|
||||
/// <param name="p_iId">Id of the bike to get.</param>
|
||||
/// <param name="id">Id of the bike to get.</param>
|
||||
/// <returns></returns>
|
||||
public BikeInfo GetById(int p_iId)
|
||||
public BikeInfo GetById(string id)
|
||||
{
|
||||
return BikeDictionary.FirstOrDefault(x => x.Key == p_iId).Value;
|
||||
return BikeDictionary.FirstOrDefault(x => x.Key == id).Value;
|
||||
}
|
||||
|
||||
/// <summary> Gets the count of bikes. </summary>
|
||||
public int Count => BikeDictionary.Count;
|
||||
|
||||
/// <summary> Gets if a bike with given id exists.</summary>
|
||||
/// <param name="p_iId">Id of bike.</param>
|
||||
/// <param name="id">Id of bike.</param>
|
||||
/// <returns>True if bike is contained, false otherwise.</returns>
|
||||
public bool ContainsKey(int p_iId) => BikeDictionary.Keys.Contains(p_iId);
|
||||
public bool ContainsKey(string id) => BikeDictionary.Keys.Contains(id);
|
||||
|
||||
/// <summary> Gets the enumerator. </summary>
|
||||
/// <returns>Enumerator object.</returns>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue