Toggle

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I need to set the property IsActive = false for all records but one
which has FileID = id

database.Files.Select(p => p.FileID != id)

I am selecting the records ... I just don't know how to change the
IsActive of all this records to false.

If possible using lambda.

Thanks,
Miguel
 
Hello,

I need to set the property IsActive = false for all records but one
which has FileID = id

database.Files.Select(p => p.FileID != id)

I am selecting the records ... I just don't know how to change the
IsActive of all this records to false.

If possible using lambda.

Thanks,
Miguel

I also tried:
database.Files.Where(p => p.FileID != id).Select(p => p.IsActive =
false);

But I get an error:
An expression tree may not contain an assignment operator
 
Not directly, no.  For some reason, there's no "ForEach()" method in the  
Enumerable class.

But, you can certainly just write a foreach() loop and do it explicitly.

Pete

Thank You Pete,
Miguel
 
Back
Top