I have two tables StudentPersonalInformation and EducationQualification
Here in MVC, I have create two model classes StudentPersonalInformation.cs and EducationQualification.cs, here I create the object of both classes in one wrapper class and that class Name is StudentInfo.cs
public class StudentPersonalInfo {
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string StudentFirstName { get; set; }
public string StudentLastName { get; set; }
public int Age { get; set; }
public string BloodGroup { get; set; }
public string Address { get; set; }
}
public class EducationQualification {
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Graduation { get; set; }
public int Grad_Marks_obtain { get; set; }
public string Grad_passing_year { get; set; }
public stringPost Graduation { get; set; }
public int PG_Marks_obtain { get; set; }
public string PG_passing_year { get; set; }
}
public class StudentInfo
{
public StudentPersonalInfo PersonalInfo { get; set; }
public EducationQualification EducationalQualification { get; set; }
}
This is the DBContext class:
public class StudentDbContext:DbContext
{
public DbSet<StudentPersonalInfo> StudentPersonalInfos { get; set; }
public DbSet<EducationQualification> EducationQualifications { get; set; }
}
And My Question is:
How to display the details by id of particular students from both tables in one view. Please tell me how to do this….
EducationQualificationbelings to which student?EducationQualification? Is it related to students anyhow?