예제 #1
0
        public ParkingLot ChooseParkingLot()
        {
            var parkingLotChosen = ParkingLotList.Where(lot => !lot.IsFull).ToList();

            return(parkingLotChosen.Any()
                ? parkingLotChosen.OrderByDescending(lot => lot.LotAvailable).First()
                : ParkingLotList[^ 1]);
예제 #2
0
        protected override ParkingLot GetParkingLot()
        {
            var maxSpaceParkingLot = ParkingLotList[0];

            foreach (var parkingLot in ParkingLotList.Where(parkingLot => parkingLot.RemianParkingSpace() > maxSpaceParkingLot.RemianParkingSpace()))
            {
                maxSpaceParkingLot = parkingLot;
            }
            return(maxSpaceParkingLot);
        }
예제 #3
0
        public ParkingLot ChooseParkingLot()
        {
            var parkingLotsChosen = ParkingLotList.Where(lot => !lot.IsFull).ToList();

            return(parkingLotsChosen.Any() ? parkingLotsChosen.First() : ParkingLotList[^ 1]);