Exemple #1
0
 public void RemoveSetOfRegistrationNumber(List <string> registrationNumbers)
 {
     foreach (var regPlate in registrationNumbers)
     {
         if (ListOfCars.Any(x => x.RegistrationNumber == regPlate))
         {
             Car car = ListOfCars.Find(x => x.RegistrationNumber == regPlate);
             ListOfCars.Remove(car);
         }
     }
     Count = ListOfCars.Count;
 }
Exemple #2
0
 public string RemoveCar(string registrationNumber)
 {
     if (!ListOfCars.Any(x => x.RegistrationNumber == registrationNumber))
     {
         return("Car with that registration number, doesn't exist!");
     }
     else
     {
         Car carForRemove = ListOfCars.Find(x => x.RegistrationNumber == registrationNumber);
         ListOfCars.Remove(carForRemove);
         Count = ListOfCars.Count;
         return($"Successfully removed {registrationNumber}");
     }
 }