public async Task <IActionResult> Delete(int Id) { if (Id == 0) { return(BadRequest()); } try { var response = await veiculosRepository.Delete(Id); if (response == 0) { return(NotFound()); } var result = new { code = 20000, data = "success" }; return(Ok(result)); } catch (Exception) { return(BadRequest()); } }
// POST: Veiculos/Delete/5 public ActionResult Delete(int id) { _veiculoRepository.Delete(id); return(RedirectToAction(nameof(Index))); }