0

我想在测试系统中创建一个QUESTION 模型。问题可能不同(文本、图片等) 答案可能不同(文本字段、复选框等)

如何在 MVC 中正确实现这一点?

供理解的图片

4

1 回答 1

0

业务/领域对象:

public class Question {
    public int Id { get; set; }
    public string Text { get; set; }
    public string ImagePath { get; set; }
    public IList<Answer> Answers { get; set; }
    public Answer CorrectAnswer { get; set; }
}

public class Answer {
    public int Id { get; set; }
    public string Text { get; set; }
}

查看型号:

public class QuestionViewModel {
    public Question Question { get; set; }
}
于 2013-03-09T18:25:22.880 回答