I am curious how to correctly update the list of objects at a time.
public ActionWas Update(IEnumerable<surcharge_template> templates) { try { var templatesToBeUpdated = _context.surcharge_template.Where(x => templates.Select(template => template.st_key).Contains(x.st_key));
I put a comment in a place where I'm not sure how to handle this. I get the source templates from the database, and then I need to match them, and then commit and save.
So what is the correct way to match them?
UPDATE:
I would like to do this with EF, only making one call to the database. Enumerating the list will result in multipe update statements.
source share