/// <summary> /// 获取编辑页面下拉列表 /// </summary> /// <param name="context">数据库连接上下文对象</param> /// <returns></returns> public async Task <MajorClassEditViewModel> GetDropDownListAsync(MajorClassEditViewModel webModel, ApplicationDbContext context) { //Get Source Data var departmentList = await SchoolRepository.GetDepartmentList(context); var staffList = await SchoolRepository.GetStaffList(context); if (departmentList != null && departmentList.Any()) { webModel.DepartmentList = departmentList.Select(item => new DepartmentDropDown { Id = item.Id.ToString(), Name = item.Name }).ToList(); } if (staffList != null && staffList.Any()) { webModel.StaffList = staffList.Select(item => new StaffDropDown { Id = item.Id.ToString(), Name = item.Name }).ToList(); } return(webModel); }