public EmployeeViewModel() { Departments = new List <SelectListItem>(); using (EmployeeEntities context = new EmployeeEntities()) { DepartmentModel dm = new DepartmentModel(context); var departments = dm.GetAllItems().OrderBy(e => e.Name); foreach (Department d in departments) { Departments.Add(new SelectListItem() { Value = d.Id.ToString(), Text = d.Name }); } } PageInfo = new PageInfo(); }