I need to set a value in a table for a subset of rows. In SQL, I would do this:
UPDATE dbo.Person SET is_default = 0 WHERE person_id = 5
Is
Just as an addition to the accepted answer, you might find your code looking more consistent when using the LINQ method syntax:
Context.person_account_portfolio
.Where(p => person_id == personId)
.ToList()
.ForEach(x => x.is_default = false);
.ToList() is neccessary because .ForEach() is defined only on List, not on IEnumerable. Just be aware .ToList() is going to execute the query and load ALL matching rows from database before executing the loop.