public async Task <IActionResult> Delete(int EventoId) { try { var evento = await _repo.GetEventoAsyncById(EventoId, false); if (evento == null) { return(NotFound()); } _repo.Delete(evento); if (await _repo.SaveChangesAsync()) { return(Ok()); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco Dados Falhou")); } return(BadRequest()); }
public async Task <IActionResult> Delete(int PalestranteId) { try { var palestrante = await _repo.GetPalestranteAsync(PalestranteId, false); if (palestrante == null) { return(NotFound()); } _repo.Delete(palestrante); if (await _repo.SaveChangesAsync()) { return(Ok()); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de dados falhou")); } return(BadRequest()); }