public List <ColegioDTO> ConsultarInstituciones() { var Datos = (from i in entity.Colegios where i.Estado == true orderby i.Nombre_Colegio select i).ToList(); List <ColegioDTO> ListaInst = new List <ColegioDTO>(); foreach (var item in Datos) { ColegioDTO oInstDTO = new ColegioDTO(); oInstDTO.Id = item.Id; oInstDTO.NIT = item.NIT; oInstDTO.Codigo_DANE = item.Codigo_DANE; oInstDTO.Nombre_Colegio = item.Nombre_Colegio; oInstDTO.Direccion = item.Direccion; oInstDTO.Correo_Colegio = item.Correo_Colegio; oInstDTO.Num_Resolucion = item.Num_Resolucion; var Municipio = (from i in entity.Municipio where i.IdMunicipio == item.Municipio.ToString() select i.NombreMunicipio).FirstOrDefault(); oInstDTO.Municipio = Municipio; oInstDTO.Tipo = item.Tipo; oInstDTO.Categoria = item.Categoria; oInstDTO.Nombre_Rector = item.Nombre_Rector; oInstDTO.Apellidos_Rector = item.Apellidos_Rector; oInstDTO.Telefono_Rector = item.Telefono_Rector; oInstDTO.Correo_Rector = item.Correo_Rector; oInstDTO.Nombre_Coordinador = item.Nombre_Coordinador; oInstDTO.Apellidos_Coordinador = item.Apellidos_Coordinador; oInstDTO.Telefono_Coordinador = item.Telefono_Coordinador; oInstDTO.Correo_Coordinador = item.Correo_Coordinador; ListaInst.Add(oInstDTO); } return(ListaInst); }
public IHttpActionResult ConsultarColegiosId(ParametrosDTO oParametros) { try { TecnicaBl objConsultarColegioBl = new TecnicaBl(); var Datos = objConsultarColegioBl.ConsultarColegiosId(oParametros.Parametro1); ColegioDTO Colegios = new ColegioDTO(); if (Datos != null) { return(Ok(new { success = true, Datos = Datos })); } else { return(Ok(new { success = false, Datos = Datos })); } } catch (Exception exc) { return(Ok(new { success = false, exc = exc.Message })); } }