我开始使用MVC 3,并使用MvcScaffolding来生成这些模型:
namespace Conference.Models
{
/*
* Speaker can have many session
* And session can have many speakers
*/
public class Speaker
{
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
public string Description { get; set; }
public virtual ICollection<Session> Sessions { get; set; }
}
public class Session
{
public Guid Id { get; set; }
[Required]
public string Title { get; set; }
[Required]
public string Description { get; set; }
[Required]
public DateTime Hour { get; set; }
public virtual ICollection<Speaker> Speakers { get; set; }
}
}
在建立这些模型之后,我可以创建会话和演讲者,但在演讲者视图中,我无法选择任何会话,在会话视图中,我也无法选择任何演讲者。
如何添加它们并使它们成为多选选项,以便我可以为一个特定的会话选择10个演讲者?
提前感谢, Yosy