public async Task <IActionResult> Delete(int?id) { if (!id.HasValue) { return(NotFound()); } try { await _timeRepositorio.DeletarTime(id.Value); } catch (TimeNaoEncontradoException ex) { return(NotFound()); } return(RedirectToAction("Index")); }
public IActionResult Delete(int id) { try { _timeRepositorio.DeletarTime(id); return(Ok()); } catch (TimeNaoEncontradoException) { return(NotFound()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }