Advertisement
MartisK

Untitled

Oct 14th, 2020
733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement