3
是否在viewmodel的构造函数中填充视图模型的模型/变量是一种好的做法?MVC视图模型构造函数
例如:
public class ProgramViewModel
{
public IEnumerable<Programme> ProgramList { get; set; }
public string QuerystringAgeID { get; set; }
public ProgramViewModel()
{
QuerystringAgeID = HttpContext.Current.Request.QueryString["QuerystringAgeID"];
}
}