public ActionResult RetornaCredores(string credor) { var result = new List<KeyValuePair<string, string>>(); IList<SelectListItem> List = new List<SelectListItem>(); var lista = new Dados().RetornaDados("Select distinct PRC_CREDOR as NOMECREDOR from processos where PRC_CREDOR like '" + credor + "%' and PRC_CREDOR is not null order by PRC_CREDOR"); foreach (System.Data.DataRow item in lista.Rows) { result.Add(new KeyValuePair<string, string>(item["NOMECREDOR"].ToString(), item["NOMECREDOR"].ToString())); } var result3 = result.Where(s => s.Value.ToLower().Contains(credor.ToLower())).Select(w => w).ToList(); return Json(result3, JsonRequestBehavior.AllowGet); }
public ActionResult RetornaCNPJCPFCredores(string credor) { string _cnpj_cpf = ""; var lista = new Dados().RetornaDados("Select TOP 1 PRC_CNPJ_CPF from processos where PRC_CREDOR like '" + credor + "%' and PRC_CREDOR is not null order by PRC_CREDOR"); foreach (System.Data.DataRow item in lista.Rows) { _cnpj_cpf = item["PRC_CNPJ_CPF"].ToString(); } return Json(_cnpj_cpf, JsonRequestBehavior.AllowGet); }