public async Task <IActionResult> Delete(string id) { try { logger.Information($"DELETE /api/values/{id}"); var value = await _repo.GetValue(id); if (value == null) { return(new NotFoundResult()); } await _repo.Delete(id); return(new OkResult()); } catch (Exception ex) { logger.Information("FALHA AO EXECUTAR A CHAMADA DA API: " + ex.Message); return(new NoContentResult()); } }
public async Task <IActionResult> Delete(int Id) { try { var results = await _repo.GetGrupoId(Id); if (results == null) { return(NotFound()); } _repo.Delete(results); if (await _repo.SaveChagesAsync()) { return(Ok()); } } catch (Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Falha no Sistema ! {ex.Message}")); } return(BadRequest()); }