asp.net mvc 3 - Deactive row instead of deleting -
i want inactivate rows instead of deleting them.
my current code deletes character. instead want set column isactive 0 (false)
[httppost, actionname("delete")] public actionresult deleteconfirmed(int id) { character character = db.characters.find(id); db.characters.remove(character); db.savechanges(); return redirecttoaction("index"); }
table definition:
characterid int isactive bit userid uniqueidentifier
public actionresult deleteconfirmed(int id) { character character = db.characters.find(id); character.isactive = false; db.savechanges(); return redirecttoaction("index"); }
if used generated .edmx, isactive should set boolean.
Comments
Post a Comment