Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        public async Task <IActionResult> Delete(int id)

        {
            try
            {
                var evento = await _repo.getAllEventoAsyncByid(id, false);

                if (evento == null)
                {
                    return(NotFound("exclusão falhou"));
                }

                _repo.Delete(evento);

                if (await _repo.SaveChangesAsync())
                {
                    return(Ok(StatusCode(StatusCodes.Status200OK, "excluido com sucesso")));
                }
            }
            catch (System.Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha ao conectar com a base de dados, tente novamente mais tarde"));
            }
            return(BadRequest());
        }
Esempio n. 3
0
        public async Task <IActionResult> Delete(int PalestranteId)
        {
            try
            {
                var palestrante = await _palestrante.GetPalestranteAsync(PalestranteId, false);

                if (palestrante == null)
                {
                    return(NotFound());
                }

                _palestrante.Delete(palestrante);

                if (await _palestrante.SaveChangesAsync())
                {
                    return(Ok(""));
                }
            }
            catch (System.Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco Dados Falhou"));
            }

            return(BadRequest());
        }