Beispiel #1
0
        public async Task <IActionResult> Create(DoctorDTO doctor)
        {
            try{
                await _doctorService.Adicionar(_mapper.Map <Doctor>(doctor));

                if (await _doctorRepository.SaveChangesAsync())
                {
                    return(CreatedAtAction("List", doctor));
                }
                else
                {
                    return(BadRequest(_notificador.ObterNotificacoes()));
                }
            }
            catch (Exception ex)
            {
                return(this.StatusCode(500, "Banco de Dados Falhou"));
            }
        }