コード例 #1
0
        public async Task <IActionResult> GetById(int id)
        {
            try
            {
                var evento = await _eventoService.GetAllEventoByIdAsync(id, false);

                if (evento == null)
                {
                    return(NotFound("Nenhum evento encontrado."));
                }
                return(Ok(evento));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar recuperar os eventos.Erro: {ex.Message}"));
            }
        }