I need to delete multiple Ids from a List of Ids.
public IHttpActionResult Delete(List<string> IDs)
{
DealBazarEntities.Restaurants.RemoveRange(IDs);
DealBazarEntities.SaveChanges();
}
But RemoveRange does not allow multiple ids , it expect only List<entities>.
Yes, I know that , if I send list of entities to server instead of sending List of ids , Then I can easily accomplish this. But I don't like that.
Again, I don't want to use foreach loop to loop through every Ids.
DealBazarEntities.Restaurants.RemoveRange(DealBazarEntities.Restaurants.Where(r => IDs.Contains(r.ID)));