Exemplo n.º 1
0
        public async Task <IActionResult> Create(PatientDTO patient)
        {
            try{
                await _patientService.Adicionar(_mapper.Map <Patient>(patient));

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