hi guys,
I have two simple classes with a Primary Key and FK relationship.
In the Sub_Department class, I get the error
> SqlException: Invalid column name 'DepartmentID1'. System.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__108_0(Task<SqlDataReader> result)
Here is my code
public class Departments_Category_Registration
{
[Key]
public int CategoryID { get; set; } // This is the PK
public Departments DepartmentID { get; set; } // this is a FKand my Departments class with the PK
public class Departments
{
[Key]
public int DepartmentID { get; set; }
[Display(Name ="Departments")]
[Required]
public string Department_Name { get; set; }
[Display(Name ="Departments")]
[Required]
public string Description_Long { get; set; }
[Display(Name ="Short Description_Short")]
[Required]
public string Description_Short { get; set; }
public bool IsEnabled { get; set; }
}
however if I update my db to change the FK to department1 it works, funny thing is that I never used 1 in my code, I had changed it from ID to DepartmentID (if that helps)
Secondly, I thought I ask, if its wise to create a separate controller for each model or not ?
Ehi