public void ChargeAFee(Parking parking, ref double earned) { foreach (var car in parking.Cars) { double fee; if (car.CarBalance > 0) { fee = parking.Settings.Prices[car.TypeOfTransport]; car.Withdraw(fee); } else { fee = parking.Settings.Prices[car.TypeOfTransport] * parking.Settings.Fine; car.Withdraw(fee); } parking.Balance += fee; earned += fee; parking.AddTransaction(car.Id, fee); } }
public static List <Transaction> TransactionsForCurtainCar(int id, Parking parking) => parking.Transactions.FindAll(x => x.Id == id);