public IEnumerable <PCBase> GetAllByPlayerID(Guid playerID) { if (!ByPlayerIDAndPCBaseID.ContainsKey(playerID)) { return(new List <PCBase>()); } var list = new List <PCBase>(); foreach (var pcBase in ByPlayerIDAndPCBaseID[playerID].Values) { list.Add((PCBase)pcBase.Clone()); } return(list); }
public IEnumerable <PCBase> GetApartmentsOwnedByPlayer(Guid playerID, int apartmentBuildingID) { var list = new List <PCBase>(); if (!ByPlayerIDAndPCBaseID.ContainsKey(playerID)) { return(list); } var apartments = ByPlayerIDAndPCBaseID[playerID].Values .Where(x => x.ApartmentBuildingID == apartmentBuildingID && x.DateRentDue > DateTime.UtcNow) .OrderBy(o => o.DateInitialPurchase); foreach (var apartment in apartments) { list.Add((PCBase)apartment.Clone()); } return(list); }