Beispiel #1
0
        public async Task Insertar(DtoBase dtoBase)
        {
            var dto = (FacturaDto)dtoBase;

            var factura = _mapper.Map <Dominio.Entidades.Factura>(dto);

            await _facturaRepositorio.Insertar(factura);
        }
Beispiel #2
0
        public ActionResult <Factura> Post(Factura factura)
        {
            try
            {
                var nuevaFactura = _facturaRepositorio.Insertar(factura);
                if (nuevaFactura == null)
                {
                    return(BadRequest());
                }

                return(CreatedAtAction(nameof(Post), new { id = nuevaFactura.IdFactura }, nuevaFactura));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error en {nameof(Post)}: {ex.Message}");
                return(BadRequest());
            }
        }