public void AddCaptures(MedicalCapturesUploadModel captures) { var appPatient = repository.Get(captures.PatientId); foreach (var capture in captures.Captures) { var appCapture = Mapper.Map <MedicalCaptureViewModel, MedicalCapture>(capture); appCapture.Patient = appPatient; appPatient.MedicalCaptures.Add(appCapture); } repository.Update(appPatient); repository.SaveChanges(); }
public IActionResult Captures([FromBody] MedicalCapturesUploadModel newCaptures) { patientService.AddCaptures(newCaptures); return(Ok()); }