Пример #1
0
        public async Task <ActionResult <ProveedorDTO> > Delete(int id)
        {
            var codigoProveedor = await _contexto.Proveedores.Select(x => x.CodigoProveedor)
                                  .FirstOrDefaultAsync(x => x == id);

            if (codigoProveedor == default)
            {
                return(NotFound());
            }

            _contexto.Remove(new Proveedor {
                CodigoProveedor = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <DetalleCompraDTO> > Delete(int id)
        {
            var idDetalle = await _contexto.DetalleCompras.Select(x => x.CodigoDetalle)
                            .FirstOrDefaultAsync(x => x == id);

            if (idDetalle == default(int))
            {
                return(NotFound());
            }

            _contexto.Remove(new DetalleCompra {
                CodigoDetalle = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #3
0
        public async Task <ActionResult <ClienteDTO> > Delete(string nit)
        {
            var nitCliente = await _contexto.Clientes.Select(x => x.Nit)
                             .FirstOrDefaultAsync(x => x == nit);

            if (nitCliente == default(string))
            {
                return(NotFound());
            }

            _contexto.Remove(new Cliente {
                Nit = nit
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #4
0
        public async Task <ActionResult <TipoEmpaqueDTO> > Delete(int id)
        {
            var codigoEmpaque = await _contexto.TipoEmpaques.Select(x => x.CodigoEmpaque)
                                .FirstOrDefaultAsync(x => x == id);

            if (codigoEmpaque == default)
            {
                return(NotFound());
            }

            _contexto.Remove(new TipoEmpaque {
                CodigoEmpaque = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #5
0
        public async Task <ActionResult <TelefonoClienteDTO> > Delete(int id)
        {
            var codigoTelefono = await _contexto.TelefonoClientes.Select(x => x.CodigoTelefono)
                                 .FirstOrDefaultAsync(x => x == id);

            if (codigoTelefono == default)
            {
                return(NotFound());
            }

            _contexto.Remove(new TelefonoCliente {
                CodigoTelefono = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #6
0
        public async Task <ActionResult <FacturaDTO> > Delete(int id)
        {
            var numeroFactura = await _contexto.Facturas.Select(x => x.Numerofactura)
                                .FirstOrDefaultAsync(x => x == id);

            if (numeroFactura == default(int))
            {
                return(NotFound());
            }

            _contexto.Remove(new Factura {
                Numerofactura = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #7
0
        public async Task <ActionResult <InventarioDTO> > Delete(int id)
        {
            var codigoInventario = await _contexto.Inventarios.Select(x => x.CodigoInventario)
                                   .FirstOrDefaultAsync(x => x == id);

            if (codigoInventario == default(int))
            {
                return(NotFound());
            }

            _contexto.Remove(new Inventario {
                CodigoInventario = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #8
0
        public async Task <ActionResult <CategoriaDTO> > Delete(int id)
        {
            var codigoCategoria = await _contexto.Categorias.Select(x => x.CodigoCategoria)
                                  .FirstOrDefaultAsync(x => x == id);

            if (codigoCategoria == default(int))
            {
                return(NotFound());
            }

            _contexto.Remove(new Categoria {
                CodigoCategoria = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
Пример #9
0
        public async Task <ActionResult <EmailClienteDTO> > Delete(int id)
        {
            var codigoEmail = await _contexto.Emailclientes.Select(x => x.CodigoEmail)
                              .FirstOrDefaultAsync(x => x == id);

            if (codigoEmail == default(int))
            {
                return(NotFound());
            }

            _contexto.Remove(new Emailcliente {
                CodigoEmail = id
            });
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }