public async Task <ActionResult> AllPatientForms(int id) { var patientForms = await _context.PatientForms.Where(m => m.IdPatient == id).ToListAsync(); var forms = await _context.Forms.ToListAsync(); List <PatientFormsHelper> list = new List <PatientFormsHelper>(); foreach (PatientForms x in patientForms) { PatientFormsHelper pom = new PatientFormsHelper { Id = x.Id, IdForm = x.IdForm, IdPatient = x.IdPatient, nazwa_formularza = forms.FirstOrDefault(n => n.Id == x.IdForm).Name, agreement = x.agreement }; list.Add(pom); } return(RedirectToAction("EntranceForm", "EntranceFormFields", new { id = id })); }
public async Task <ObjectResult> PatientForms(int id) { var patientForms = await _context.PatientForms.Where(m => m.IdPatient == id && m.agreement == true).ToListAsync(); var forms = await _context.Forms.ToListAsync(); List <PatientFormsHelper> list = new List <PatientFormsHelper>(); foreach (PatientForms x in patientForms) { PatientFormsHelper pom = new PatientFormsHelper { Id = x.Id, IdForm = x.IdForm, IdPatient = x.IdPatient, nazwa_formularza = forms.FirstOrDefault(n => n.Id == x.IdForm).Name, agreement = x.agreement }; list.Add(pom); } return(Ok(list)); }