Good day guys,
I'm trying to save a multiple records.
I've done my research but none of them actually works on my end.
Here's my code:
var dataToUpdate = context.Employees.ToList();
using(var db = context){
var department= "IT";
dataToUpdate.ForEach(x=>{
x.department = department;
});
db.SaveChanges()
}
Source here: EF - Update multiple rows in database without using foreach loop but it doesn't work.
I tried to put breakpoints and try catch and my breakpoint goes to db.SaveChanges
without error. But when I check the data from db, no changes have occurred.