MartisK

Untitled

Oct 14th, 2020
590
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public List<Car> CarInspectionCheck()
  2. {
  3.     List<Car> result = new List<Car>();
  4.     DateTime currentDate = DateTime.Today;
  5.  
  6.     foreach (var car in allCars)
  7.     {
  8.         if (DateTime.Compare(currentDate, car.TechnicalInspectionDate) => 0 || (car.TechnicalInspectionDate - currentDate).TotalDays <= 30)
  9.         {
  10.             result.add(car);
  11.         }
  12.     }
  13.  
  14.     return result;
  15. }
RAW Paste Data