c# - Update multiple entities in MVC4 with LINQ, SQLquery -



c# - Update multiple entities in MVC4 with LINQ, SQLquery -

is possible update/remove multiples entities, illustration

[httppost, actionname("removeresponsible")] public actionresult removeresponsibleaction(responsible modelo) { responsible responsible = db.responsibles.single(x => x.responsible_id == modelo.responsible_id); db.responsibles.remove(responsible); db.savechanges(); viewbag.responsible = db.responsibles.tolist(); homecoming view("responsiblemanager"); }

this code works 1 single responsible unique id, how can if there many responsible same id? example, know sql "delete table responsible_id=3".

if using entity framework 6 can utilize removerange method:

var responsibles = db.responsibles.where(x => x.responsible_id == modelo.responsible_id).tolist(); db.responsibles.removerange(responsibles);

c# asp.net-mvc linq entity-framework asp.net-mvc-4

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -