score:1

Your predicate should just be the where part of the query (a predicate just returns true or false). Try this:

instance.userinfoes.Where(user => user.userid == 313).First().Interest = 0.98;

score:0

You can structure LINQ similar to how you'd structure SQL. Through a combination of Where and ForEach you should be able to update all the rows you need. I.e:

    instance.userinfoes.Where(it => it.UserId == 313).ToList()
                       .ForEach(
                           it => it.Interest = 0.98M
                        );

There's not really any way to write SQL-like queries as text and pass them to regular LINQ as far as I know.

See this question for more solutions: Update all objects in a collection using LINQ


Related Articles