Esempio n. 1
0
        public async Task<IActionResult> Post(Evento model)
        {
            try
            {
                var evento = await _eventoService.AddEventos(model);
                if(evento ==null) return BadRequest("Erro ao tentar adicionar evento.");

                return Ok(evento);
            }
            catch (System.Exception ex)
            {
                return this.StatusCode(StatusCodes.Status500InternalServerError, 
                $"Erro ao tentar adicionar eventos. Erro: {ex.Message}");
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Post(Evento model)
        {
            try
            {
                var evento = await _eventoService.AddEventos(model);

                if (evento == null)
                {
                    return(BadRequest("Erro ao adicionar evento"));
                }
                return(Ok(evento));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Erro ao tentar adicionar um evento. Erro: {e.Message}"));
            }
        }
Esempio n. 3
0
        public async Task <IActionResult> Post(EventoDto model)
        {
            try
            {
                var evento = await _eventoService.AddEventos(User.GetUserId(), model);

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

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