public ActionResult Index() { using (DeptManager) { var disp = new vmInstructorSearch(); disp.Departments = DeptManager.GetAllDepartments().ToList(); return(View(disp)); } }
public ActionResult Index(vmInstructorSearch vm) { List <InstructorDetail> toreturn = new List <InstructorDetail>(); IEnumerable <InstructorDetail> instructors = null; using (InstManager) { instructors = InstManager.GetAllTextbookDetails(); if (vm.SelectedDept > 0) { instructors = instructors.Where(inst => inst.DepartmentID == vm.SelectedDept); } if (!string.IsNullOrEmpty(vm.SearchText)) { instructors = instructors.Where(inst => inst.FullName.Contains(vm.SearchText)); } JsonResult ret = Json(instructors.ToList()); return(ret); } }