2017-11-04 57 views
0

我新的ASP.NET MVC和我一直在试图创造,我有这三个班的学校申请:使用外键获取更多列可能吗?

public class student 
{ 
    public int id { get; set; } 
    public string name { get; set; } 
} 

public class subject 
{ 
    public int id { get; set; } 
    public int Math { get; set; } 
    public int Computer { get; set; } 
    public int Chemistry { get; set; } 
} 

public class result 
{ 
    public int id { get; set; } 
    public int studentId { get; set; } 
    public int subjectId { get; set; } 
    public int Total { get; set; } 

    public virtual student students { get; set; } 
    public virtual subject subjects { get; set; } 
} 

我想主题的所有属性的结果喜欢数学,计算机,化学,所以我可以在结果页面上编辑,创建或删除它们。

有人可以指向我的任何教程或帮助我吗?

+0

您尝试创建一个应用程序之前,请阅读数据库规范化一些教程,然后尝试去学习如何在DATABSE使用代码第一种方法建模。就目前而言,您的代码存在太多缺陷。 – CodingYoshi

回答

0

一个很好的出发点可能是 here