adding/removing records if it was or wasn't there
I am making an application the user uploads a file and then choose all the categories associated with the file.
the first view the user has the option to upload a file then a group of checkboxes appears for adding the required categories
the problem comes when editing a file开发者_JS百科 you can choose to check/uncheck the checkboxes uncheck means delete the record if it was there and check means add if it wasn't
i can't figure out how to make the linq query for this scenario to add/delete if it was or wasn't
When the user click "update" , you could first delete all the associations between the selected file and his related categories, then insert only the selected ones, and now you're sure they don't exists.
精彩评论