public JsonResult ReadRemoteList(string tableName, string formTblName, string query, int?Id) { if (Id != null && tableName != "World") { return(Json(_hrUnitOfWork.PagesRepository.GetRemoteList(tableName, query, formTblName, CompanyId, Language, Id.Value.ToString()).Select(q => new { id = q.Id, name = q.Name, Icon = q.Icon, PicUrl = q.PicUrl, Gender = q.Gender }), JsonRequestBehavior.AllowGet)); } if (query == "") { query = "%"; } else if (query.IndexOf('*') >= 0) { query = query.Replace('*', '%'); } else { query = "%" + query + "%"; } if (tableName == "World") { string lang = Language.Substring(0, 2) == "ar" ? "Ar" : ""; IEnumerable <myWorld> result = _hrUnitOfWork.SqlQuery <myWorld>("SELECT top 7 CountryId id,CountryId country, CityId city, DistrictId dist, Name" + lang + " name FROM v_World where Name" + lang + " like '" + query + "'").ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); } else { var result = _hrUnitOfWork.PagesRepository.GetRemoteList(tableName, query, formTblName, CompanyId, Language, "").Select(q => new { id = q.Id, name = q.Name, Icon = q.Icon, PicUrl = q.PicUrl, Gender = q.Gender }); return(Json(result, JsonRequestBehavior.AllowGet)); } }