예제 #1
0
        public async Task <IActionResult> Get(int id)
        {
            try
            {
                var evento = await _eventoService.GetEventoByIdAsync(id, true);

                if (evento == null)
                {
                    return(NoContent());
                }
                return(Ok(evento));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar recuperar eventos. Erro: {ex.Message}"));
            }
        }
예제 #2
0
        private async Task <bool> AutorEvento(int eventoId)
        {
            var evento = await _eventoService.GetEventoByIdAsync(User.GetUserId(), eventoId, false);

            if (evento == null)
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
        public async Task<IActionResult> GetById(int id)
        {
             try
            {
                var evento = await _eventoService.GetEventoByIdAsync(id, 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}");
            }
        }
예제 #4
0
        public async Task <ActionResult> GetById(int id)
        {
            try
            {
                var evento = await _eventoService.GetEventoByIdAsync(id, true);

                if (evento == null)
                {
                    return(NotFound($"Nenhum evento encontrado com o id: {id}"));
                }
                return(Ok(evento));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Erro ao tentar recuperar o evento pelo id: {id}. Erro: {e.Message}"));
            }
        }