public ParkingLot ChooseParkingLot() { var parkingLotChosen = ParkingLotList.Where(lot => !lot.IsFull).ToList(); return(parkingLotChosen.Any() ? parkingLotChosen.OrderByDescending(lot => lot.LotAvailable).First() : ParkingLotList[^ 1]);
protected override ParkingLot GetParkingLot() { var maxSpaceParkingLot = ParkingLotList[0]; foreach (var parkingLot in ParkingLotList.Where(parkingLot => parkingLot.RemianParkingSpace() > maxSpaceParkingLot.RemianParkingSpace())) { maxSpaceParkingLot = parkingLot; } return(maxSpaceParkingLot); }
public ParkingLot ChooseParkingLot() { var parkingLotsChosen = ParkingLotList.Where(lot => !lot.IsFull).ToList(); return(parkingLotsChosen.Any() ? parkingLotsChosen.First() : ParkingLotList[^ 1]);