示例#1
0
        public IActionResult Put(int id, AgendamentoDto agendamentoDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != agendamentoDto.Id)
            {
                return(BadRequest("Identificadores do agendamento estão divergentes"));
            }

            if (!Exists(id))
            {
                return(NotFound());
            }

            _agendamentoRepository.BeginTransaction();

            // editando
            _agendamentoService.Put(agendamentoDto);

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

            _agendamentoRepository.CommitTransaction();

            return(NoContent());
        }