Exemple #1
0
        public IActionResult Post(AgendamentoDto agendamentoDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _agendamentoRepository.BeginTransaction();

            // cadastrando
            _agendamentoService.Post(agendamentoDto);

            if (_notification.Any)
            {
                _agendamentoRepository.RollbackTransaction();
                return(BadRequest());
            }

            _agendamentoRepository.CommitTransaction();

            return(Created(agendamentoDto));
        }