public async Task <ActionResult <Veiculo> > DeleteVeiculo(Guid id) { var veiculo = await _veiculoService.Selecionar(id); if (veiculo == null) { return(NotFound()); } await _veiculoService.Delete(veiculo); return(veiculo); }
public async Task <IActionResult> Delete([FromQuery(Name = "id")] int id) { var item = await _service.Find(id); if (item == null) { return(NotFound()); } await _service.Delete(item); return(NoContent()); }
public IHttpActionResult Delete(Guid id) { bool success; try { success = _service.Delete(id); return(Ok(success)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <ActionResult <VeiculoDto> > Delete(int id) { try { var veiculo = await veiculoService.GetById(id, GetIdUsuarioLogado()); if (veiculo == null) { return(NotFound()); } await veiculoService.Delete(id); return(Ok()); } catch (Exception ex) { return(BadRequest(new ErrorResponse(ex.Message))); } }