public async Task <ActionResult> DeleteAsync(string id)
        {
            FacturasDA facturasDA = new FacturasDA(Context);

            if (await facturasDA.DeleteFacturaAsync(id: id).ConfigureAwait(false))
            {
                return(Ok());
            }
            return(NotFound());
        }
        public async Task <ActionResult> Post([FromBody] Factura factura)
        {
            FacturasDA facturasDA = new FacturasDA(Context);

            if (await facturasDA.AddFacturaAsync(factura).ConfigureAwait(false))
            {
                return(new CreatedAtRouteResult("GetFactura", new { id = factura.Id }, factura));
            }
            return(BadRequest());
        }
        public async Task <ActionResult <Factura> > GetAsync(string id)
        {
            FacturasDA facturasDA = new FacturasDA(Context);
            var        factura    = await facturasDA.GetFacturaByIdAsync(id : id).ConfigureAwait(false);

            if (factura == null)
            {
                return(NotFound());
            }
            return(factura);
        }
        public async Task <ActionResult> PutAsync(string id, [FromBody] Factura factura)
        {
            if (id != factura.Id)
            {
                return(BadRequest());
            }
            FacturasDA facturasDA = new FacturasDA(Context);

            if (await facturasDA.UpdateFacturaAsync(factura: factura).ConfigureAwait(false))
            {
                return(Ok());
            }
            return(BadRequest());
        }
        public async Task <ActionResult <IEnumerable <Factura> > > GetAsync()
        {
            FacturasDA facturasDA = new FacturasDA(Context);

            return(await facturasDA.GetFacturasAsync().ConfigureAwait(false));
        }