I am facing a problem when try to update records via using dbset. The following is my code:
CROPContext db = new CROPContext();
var EPins = from EPin in db.Pins.Take(5)
where
(EPin.UserID == null && EPin.CC == 5000)
select EPin;
foreach (var item in Epins.ToList())
{
item.OrderID = OrderID;
item.UserID = intUserID;
}
db.SaveChanges();
When I update the records, it update all records. Then I check the number EPins.Count(), I find out that it is not 5 but the number of all. If I want to update the first 5 records, what should I do?