public ActionResult GetDepartmentForSelectListOnDemand(string searchTerm) { List <SelectListItem> departmentSelectList = _departmentBusiness.GetDepartmentSelectList(); var list = departmentSelectList != null ? (from SelectListItem in departmentSelectList.Where(x => x.Text.ToLower().Contains(searchTerm.ToLower())).ToList() select new Select2Model { text = SelectListItem.Text, id = SelectListItem.Value, }).ToList() : new List <Select2Model>(); return(Json(new { items = list }, JsonRequestBehavior.AllowGet)); }
public ActionResult MasterPartial(Guid masterCode) { EmployeeViewModel employeeVM = masterCode == Guid.Empty ? new EmployeeViewModel() : Mapper.Map <Employee, EmployeeViewModel>(_employeeBusiness.GetEmployee(masterCode)); employeeVM.IsUpdate = masterCode == Guid.Empty ? false : true; employeeVM.Department = new DepartmentViewModel(); employeeVM.Department.DepartmentSelectList = _departmentBusiness.GetDepartmentSelectList(); employeeVM.Position = new PositionViewModel(); employeeVM.Position.PositionSelectList = _positionBusiness.GetPositionSelectList(); if (masterCode == Guid.Empty) { employeeVM.IsActive = true; } return(PartialView("_EmployeeForm", employeeVM)); }