System.NullReferenceException: Object reference not set to an instance of an object.
I'm developing a Asp.net Api which consist in the updating a existing Object into another, but when I use the controller, return the following error:
This is the model:
The controller logic consist in the searching through Subject to find whether a teacher is settled (I mean when it's not null) or not. If is does exist, then search for a existing Teacher and set teacher using his Dni as a foreign key :
I must to mention that I'm doing this with existing data of database's seed .
System.NullReferenceException: Object reference not set to an instance of an object.This is the model:
The controller logic consist in the searching through Subject to find whether a teacher is settled (I mean when it's not null) or not. If is does exist, then search for a existing Teacher and set teacher using his Dni as a foreign key :
I must to mention that I'm doing this with existing data of database's seed .