예제 #1
0
        public async Task <IActionResult> Edit(PatientDTO patient)
        {
            try{
                var _patient = await _patientRepository.GetPatient(patient.Id);

                if (_patient == null)
                {
                    return(NotFound());
                }


                await _patientService.Atualizar(_mapper.Map <Patient>(patient));

                if (await _patientRepository.SaveChangesAsync())
                {
                    return(CreatedAtAction("Index", patient));
                }

                else
                {
                    return(BadRequest(_notificador));
                }
            }
            catch (Exception ex)
            {
                return(this.StatusCode(500, "Banco de Dados Falhou"));
            }
        }