コード例 #1
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var eventos = await _eventoService.GetAllEventosAsync(true);

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

                return(Ok(eventos));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar recuperar eventos. Erro {ex.Message}"));
            }
        }
コード例 #2
0
        public async Task<IActionResult> Get()
        {
            try
            {
                var eventos = await _eventoService.GetAllEventosAsync(true);
                if(eventos == null) return NotFound("Nenhum Evento Encontrado.");

                return Ok(eventos);
            }
            catch (System.Exception ex)
            {
                
                return this.StatusCode(StatusCodes.Status500InternalServerError,
                $"Erro ao tentar recuperar eventos. Erro: {ex.Message}");
            }
        }
        public async Task <IActionResult> Get()
        {
            try
            {
                var eventos = await _eventoService.GetAllEventosAsync(true);

                if (eventos == null)
                {
                    return(NotFound("Nenhum registro encontrado!"));
                }

                return(Ok(eventos));
            }
            catch (System.Exception ex)
            {
                return(StatusCode(500, "Erro: " + ex.Message));
            }
        }
コード例 #4
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var eventos = await _eventoService.GetAllEventosAsync(false);

                if (eventos == null)
                {
                    return(NotFound("Nenhum evento encontrado."));
                }
                return(Ok(eventos));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar recuperar os eventos.Erro: {ex.Message}"));
            }
        }
コード例 #5
0
        public async Task <IActionResult> Get([FromQuery] PageParams pageParams)
        {
            try
            {
                var eventos = await _eventoService.GetAllEventosAsync(User.GetUserId(), pageParams, true);

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

                Response.AddPagination(eventos.CurrentPage, eventos.PageSize, eventos.TotalCount, eventos.TotalPages);

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