I need to display text boxes of two classes in one view. I use the Entity framework database first approach and don't know how to display 2 data models in one view. Also, I need to hide one of these class text boxes and show up on the click of a button.
Here is the first class "Task"
public partial class Tasks1
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Tasks1()
{
this.Sub_tasks = new HashSet<Sub_tasks>();
}
public int Task_id { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public Nullable<System.DateTime> Start_date { get; set; }
public Nullable<System.DateTime> End_date { get; set; }
public string Assigned_dept { get; set; }
public string Assigned_emp { get; set; }
public string Priority_type { get; set; }
public Nullable<bool> Status { get; set; }
public int Step_id { get; set; }
public virtual Step Step { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Sub_tasks> Sub_tasks { get; set; }
}
This is the second
public partial class Step
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Step()
{
this.Tasks1 = new HashSet<Tasks1>();
}
public int Step_id { get; set; }
public string Step_type { get; set; }
public Nullable<bool> Status { get; set; }
public int Process_id { get; set; }
public virtual Process Process { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Tasks1> Tasks1 { get; set; }
}
The error I got.

please help me! if my question is stupid, please be kind enough to explain this.