コード例 #1
0
        public async Task <IActionResult> Post(Evento model)
        {
            try
            {
                var eventos = await _eventosService.AddEvento(model);

                if (eventos == null)
                {
                    return(BadRequest("Erro ao tentar adicionar Evento"));
                }

                return(Ok(eventos));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar salvar evento: Erro {ex.Message}"));
            }
        }
コード例 #2
0
        public async Task <IActionResult> Post(Evento model)
        {
            try
            {
                var evento = await _eventoService.AddEvento(model);

                if (evento == null)
                {
                    return(BadRequest("Erro ao adicionar evento."));
                }

                return(Ok(evento));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       "Erro ao tentar adicionar evento. Erro: " + ex.Message));
            }
        }