private void InsertExaminationsByIds(string klassName, PatientVisit patientVisit, IEnumerable <int> toInsertIds) { PatientExamination examination; var igs = _context.PatientImmunoglobulins.Where(pe => toInsertIds.Contains(pe.ID)).ToList(); var currentCollection = PatientExamination.EntityTypes(_context, klassName); var items = currentCollection.Where(pe => toInsertIds.ToList().Contains(pe.ID)); foreach (var item in items) { examination = PatientExamination.BuildPatientExamination(klassName, TABS_KLASSES_LIST[klassName], item.ID.ToString(), patientVisit); _context.Add(examination); } }
private List <PatientExamination> SaveExamination(string klass, string propertyName, PatientVisit patientVisit) { var selected = _form.Keys.Where(k => k.Contains(klass)).ToList(); var savedItems = new List <PatientExamination>(); for (var cursor = 0; cursor < selected.Count; cursor++) { var itemId = _form[klass + "[" + cursor + "].ID"]; var isChecked = _form[klass + "[" + cursor + "].Selected"]; if (isChecked == "on") { var examination = PatientExamination.BuildPatientExamination(klass, propertyName, itemId, patientVisit); savedItems.Add(examination); } } return(savedItems); }