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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top