void bindList(StudentListModel model) { model.ClassIdSelect = ClassMBiz.GetAll().Select(s => new SelectListItem { Value = s.Id, Text = s.Name }); }
void bind(MyTestModel model) { model.Select1 = StudentBiz.GetAll().Select(s => new SelectListItem { Value = s.Sn.ToString(), Text = s.Name }); model.Select2 = StudentBiz.GetAll().Select(s => new SelectListItem { Value = s.Sn.ToString(), Text = s.Name }); //班級 model.ClassSelect = ClassMBiz.GetAll().Select(s => new SelectListItem { Value = s.Id.ToString(), Text = s.Name }); if (!string.IsNullOrWhiteSpace(model.ClassId)) { var list = StudentBiz.ClassData(model.ClassId).Select(s => new SelectListItem { Value = s.Sn.ToString(), Text = s.Name }); model.StudentSelect = list; } else { model.StudentSelect = new List <SelectListItem>(); } }