public JsonResult GetAutoSkills(string Prefix, int empId) { List <Skill> result; if (string.IsNullOrEmpty(Prefix)) { result = skillsbusinessManager.GetUnmappedSkillsByEmpId(empId); } else { result = skillsbusinessManager.GetUnmappedSkillsByEmpId(empId); result = result.Where(s => s.Name.ToLower().Contains(Prefix.ToLower())).ToList(); } var translatedResult = SkillModel.Translate(result); // to avoid circular reference return(Json(translatedResult, JsonRequestBehavior.AllowGet)); }
//************************************ Autocomplete ********************************************* // autocomplete for skills public JsonResult GetAutoSkills(string Prefix) { List <Skill> result; List <Skill> all; if (string.IsNullOrEmpty(Prefix)) { all = skillsbusinessManager.GetAll(); result = all.Except(searchSkills, new IdComparer()).ToList(); } else { all = skillsbusinessManager.GetAll(); result = all.Except(searchSkills, new IdComparer()).ToList(); result = result.Where(s => s.Name.ToLower().Contains(Prefix.ToLower())).ToList(); } var translatedResult = SkillModel.Translate(result); return(Json(translatedResult, JsonRequestBehavior.AllowGet)); }