Пример #1
0
        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);
        }
Пример #2
0
        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);
        }