Esempio n. 1
0
        public async Task<IActionResult> GetByTema(string tema)
        {
             try
            {
                var evento = await _eventoService.GetAllEventosByTemaAsync(tema, true);
                if(evento == null) return NotFound("Nenhum Evento Encontrado.");

                return Ok(evento);
            }
            catch (System.Exception ex)
            { 
                return this.StatusCode(StatusCodes.Status500InternalServerError,
                $"Erro ao tentar recuperar eventos. Erro: {ex.Message}");
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> GetByTema(string tema)
        {
            try
            {
                var evento = await _eventoService.GetAllEventosByTemaAsync(tema, true);

                if (evento == null)
                {
                    return(NotFound($"Nenhum evento encontrado com o tema: {tema}"));
                }
                return(Ok(evento));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Erro ao tentar recuperar o evento pelo tema: {tema}. Erro: {e.Message}"));
            }
        }
        public async Task <IActionResult> GetByTema(string tema)
        {
            try
            {
                var evento = await _eventoService.GetAllEventosByTemaAsync(tema, true);

                if (evento == null)
                {
                    return(NotFound("Eventos por tema não encontrados!"));
                }

                return(Ok(evento));
            }
            catch (System.Exception ex)
            {
                return(StatusCode(500, "Erro: " + ex.Message));
            }
        }
Esempio n. 4
0
        public async Task <IActionResult> Get(string tema)
        {
            try
            {
                var evento = await _eventoService.GetAllEventosByTemaAsync(tema, true);

                if (evento == null)
                {
                    return(NotFound(" eventos por tema não encontrado."));
                }
                return(Ok(evento));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar recuperar eventos. Erro: {ex.Message}"));
            }
        }
Esempio n. 5
0
        public async Task <IActionResult> GetByTema(string tema)
        {
            try
            {
                var eventos = await _eventoService.GetAllEventosByTemaAsync(tema, true);

                if (eventos == null)
                {
                    return(NoContent());
                }

                return(Ok(eventos));
            }
            catch (Exception err)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar recuperar eventos por Tema. Erro: {err.Message}"));
            }
        }