我这里有一个复杂的问题。这是所需的界面:
当您点击Add grade
时,会使用javascript添加select和input.text。这里的问题是如何将所有这些转移到控制器?
以下是使用的模型:
public class Student {
public int Id { get; set; }
[Required]
[Display(Name = "First name")]
public string FirstName { get; set; }
[Required]
[Display(Name = "Last name")]
public string LastName { get; set; }
[Required]
[Display(Name = "Grades")]
public virtual IList<Grade> Grades { get; set; }
}
public class Grade {
public int Id { get; set; }
public int ClassId { get; set }
public int StudentId { get; set; }
[Required]
[Display(Name = "Class")]
public virtual Class Class { get; set; }
[Required]
[Display(Name = "Value")]
public string Value { get; set; }
}
public class Class {
public int Id { get; set; }
[Required]
[Display(Name = "Name")]
public string Name { get; set; }
}
有没有人遇到过这个?
答案 0 :(得分:0)