示例#1
0
        public ActionResult GetPositionForSelectListOnDemand(string searchTerm)
        {
            List <SelectListItem> positionSelectList = _positionBusiness.GetPositionSelectList();
            var list = positionSelectList != null ? (from SelectListItem in positionSelectList.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));
        }
示例#2
0
        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));
        }