public async Task <IActionResult> PutPatient(int id, PatientUpdateDto patient) { if (id != patient.Id) { return(BadRequest()); } try { var item = _mapper.Map <Patient>(patient); await _repository.Update(item); } catch (DbUpdateConcurrencyException) { var t = await PatientExists(id); if (!t) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual async Task <PatientDto> UpdateAsync(Guid id, PatientUpdateDto input) { var patient = await _patientRepository.GetAsync(id); _objectMapper.Map(input, patient); patient = await _patientRepository.UpdateAsync(patient); return(_objectMapper.Map <Patient, PatientDto>(patient)); }
public IActionResult UpdatePatient([FromBody] PatientUpdateDto patientsDto) { if (patientsDto == null) { return(BadRequest(ModelState)); } var patientObj = _mapper.Map <Patient>(patientsDto); if (!_patients.UpdatePatient(patientObj)) { ModelState.AddModelError("", $"Something went wrong when you trying to updating {patientObj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public PatientRowViewModel(PatientUpdateDto patient) { Patient = patient; AddressVm = new AddressViewModel(Patient.Address); }
public Task <PatientDto> UpdateAsync(Guid id, PatientUpdateDto input) { return(_patientAppService.UpdateAsync(id, input)); }