public IActionResult Delete(string id) { var vehiculo = _vehiculoService.GetVehiculo(id); var soli = _solicitudService.GetV(vehiculo.placa); if (vehiculo == null) { return(NotFound()); } _vehiculoService.Remove(vehiculo.Id); if (soli != null) { _solicitudService.Remove(soli.Id); } return(Ok()); }
public IActionResult Delete(string id) { var vehiculo = _vehiculoService.GetVehiculo(id); var soli = _solicitudService.GetV(vehiculo.placa); if (vehiculo == null) { return(NotFound()); } var filter = Builders <BsonDocument> .Filter.Eq("id", id); _vehiculoService.Remove(vehiculo.Id); if (soli != null) { _solicitudService.Remove(soli.Id); } return(Ok()); }
public IActionResult Delete(string id) { var cliente = _clienteService.Get(id); if (cliente == null) { return(NotFound()); } List <Vehiculo> lista = _vehiculoService.GetByCliente(cliente.Id); _clienteService.Remove(cliente.Id); if (lista != null) { for (int i = 0; i < lista.Count; i++) { _vehiculoService.Remove(lista.ElementAt(i).Id); } } return(NoContent()); }