How to update foreign key back to NULL?
How do i update a foreign key column back to null?
On insert or update i use this:
getCategory = _db.Categories.Find(id);
Events.Categories = getCategory; //add foreign key
But if the category is 0 (not selected) i want to update the relationship Category_ID back to null.
Try to do it like that:
Events.Categories = null; //add foreign key
But it doesn't seems to work
Please advise
Thanks