Exemplo n.º 1
0
        public IActionResult Post([FromBody] Agendamento agendamentoDto)
        {
            try
            {
                var agendamento = _agendamentoService.Create(agendamentoDto);
                if (agendamento == null)
                {
                    return(BadRequest("Horário indisponível."));
                }

                return(Created($"https://localhost:44399/api/agendamentos/{agendamento.Id}", agendamento));
            }
            catch (System.Exception)
            {
                return(StatusCode(500));
            }
        }
Exemplo n.º 2
0
 public async Task <ResultDto <AgendamentoDto> > Post([FromBody] AgendamentoDto agendamentoDto)
 {
     return(await _agendamentoService.Create(agendamentoDto));
 }