I am trying to save to the database tables "Employee" and "Employee_languages" I am recieving this following error (upon saving?) Entities in 'knowitCVdbEntities.EMPLOYEE_LANGUAGES' participate in
the 'FK_EMPLOYEE_LANGUAGES_EMPLOYEES' relationship. 0 related 'EMPLOYEES' were found.
1 'EMPLOYEES' is expected.
This is my method for saving
public void setEmployee(string fileName)
{
var emp = new EMPLOYEE
{
firstname = TextBoxFirstName.Text,
lastname = TextBoxLastName.Text,
about = TextBoxAboutYou.Text,
phone = TextBoxPhone.Text,
position = TextBoxPosition.Text,
email = TextBoxEmail.Text,
username = TextBoxUsername.Text,
date_of_birth = TextBoxDateOfBirth.Text,
image = FileUploadPicture.FileName
};
var emplanguages = new EMPLOYEE_LANGUAGES();
{
emplanguages.language_name = ListBoxLanguages.Text;
}
var db = new knowitCVdbEntities();
db.AddToEMPLOYEES(emp);
db.AddToEMPLOYEE_LANGUAGES(emplanguages);
db.SaveChanges();
}
I was under the assumption that my code was correct, but there must be something wrong. What seems to be the issue here?