In a daily import procedure processed in an MVC application, I need to delete all entities that have a datestamp in a fixed timehorizon before doing the actual import. Is there a way to bring this code..
var deleteShows = db.Shows.Where(x => x.begin >= DateTime.Today.Date).ToList();
foreach (Show show in deleteShows)
{
db.Shows.Remove(show);
}
db.SaveChanges();
.. into a shorter / quicker version, something like
db.Shows.Where(x => x.begin >= DateTime.Today.Date).ToList().ForEach(db.Shows.Remove(???));