Пример #1
0
 private void RemoveVehiclesOlderThan(int days, int carLimit)
 {
     try
     {
         List <Vehicle> vehicleArchived = RepoVehicle.FindAllArchived();
         for (int i = 0; i < vehicleArchived.Count || i > carLimit; i++)
         {
             if (vehicleArchived[i].DateAuctionEnd.AddDays(days) < DateTime.Now)
             {
                 RepoVehicle.Delete(vehicleArchived[i]); //cascade deleting (images)
             }
         }
     }
     catch
     {
         //do nothing, app working is more important than removing
     }
 }
 public void Delete(int id)
 {
     repository.Delete(id);
 }