public async Task <ActionResult> Get(Guid id)
        {
            var tipoIdentificacion = await _context.TiposIdentificacion.FirstOrDefaultAsync(x => x.Id == id);;

            if (tipoIdentificacion == null)
            {
                return(NotFound());
            }

            var result = new TiposIdentificacionDto
            {
                Id          = tipoIdentificacion.Id,
                Nombre      = tipoIdentificacion.Nombre,
                Descripcion = tipoIdentificacion.Descripcion
            };

            return(Ok(result));
        }
        public async Task <IActionResult> Update([FromBody] TiposIdentificacionDto tipoIdentificacion)
        {
            var modificar = await _context.TiposIdentificacion.FirstOrDefaultAsync(x => x.Id == tipoIdentificacion.Id);


            if (modificar == null)
            {
                return(BadRequest("El tipo de identificación no existe"));
            }

            modificar.Nombre            = tipoIdentificacion.Nombre;
            modificar.Descripcion       = tipoIdentificacion.Descripcion;
            modificar.FechaModificacion = DateTime.Now;

            _context.TiposIdentificacion.Update(modificar);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        public async Task <ActionResult> Create([FromBody] TiposIdentificacionDto tipoIdentificacion)
        {
            var validar = await _context.TiposIdentificacion.FirstOrDefaultAsync(x => x.Nombre == tipoIdentificacion.Nombre);

            if (validar != null)
            {
                return(BadRequest("El Tipo de identificación ya existe"));
            }

            var nuevoTipoIdentificacion = new TipoIdentificacion
            {
                Id                = Guid.NewGuid(),
                Nombre            = tipoIdentificacion.Nombre,
                Descripcion       = tipoIdentificacion.Descripcion,
                FechaCreacion     = DateTime.Now,
                FechaModificacion = DateTime.Now
            };

            _context.TiposIdentificacion.Add(nuevoTipoIdentificacion);
            await _context.SaveChangesAsync();

            return(Ok());
        }