I SERIOUSLY recommend you get
this book[
^] and work through it. There's a ton of concepts you're missing as evidenced by your code and you're not going to learn them in a forum like this.
Your code doesn't make any sense at all and your variable names need to be redone to make them meaningful and easier to read and debug.
A typical update operation in EF goes something like this:
using (var context = new MyDbContext())
{
Employee employee = context.Employees.Find(employeeId);
employee.Property = some new value;
...
context.Entry(employee).State = EntityState.Modified;
context.SaveChanges();
}
I don't konw what you're doing with the whole "Attach" thing, but it looks really wrong. Attach is normally used to tell the Entity Tracker to start tracking changes to an object that it did NOT get from the database, like adding a new object. I rarely ever use it in my work.