Using MVC4 I’m trying to insert a column into a linking table that has a two column composite key. Both columns are primary key in two separate tables.
Key1 is picked up from a hidden field in the web form which is generated from an id passed in the URL.
Key2 is the selected value picked up from a dropdown list of names from the second PK table.
As far as I can tell, the values are correct (they appear in the two primary key tables).
Does anyone know why I’m getting an error from the HttpPost Create action (mainly default scaffolding code) that tells me there is a conflict with the first PK -> FK constraint?
The error here was caused by the naming of the “id” in the controller. Need to remember when I’m accessing database values vs returning view values. Can we put it down to lack of sleep and a medical ban on caffiene?