Exemplo n.º 1
0
        public IActionResult Listar()
        {
            try
            {
                List <DatoTipo>   datoTipos   = DatoTipoDAO.getDatoTipos();
                List <stdatotipo> lstdatotipo = new List <stdatotipo>();
                foreach (DatoTipo datoTipo in datoTipos)
                {
                    stdatotipo temp = new stdatotipo();
                    temp.id          = datoTipo.id;
                    temp.nombre      = datoTipo.nombre;
                    temp.descripcion = datoTipo.descripcion;
                    lstdatotipo.Add(temp);
                }

                return(Ok(new { success = true, datoTipos = lstdatotipo }));
            }
            catch (Exception e)
            {
                CLogger.write("1", "DatoTipo.class", e);
                return(BadRequest(500));
            }
        }