public IActionResult Details(int id) { var model = new PacientMedicMedicineViewModel(); var pacient = pacientData.Get(id); var medics = new List <Medic>(); foreach (var pair in medicPacientData.GetAll()) { if (pair.PacientId == id) { var medic = medicData.Get(pair.MedicId); medics.Add(medic); } } var consultatii = new List <ConsultatieViewModel>(); foreach (var pair in consultatieData.GetAll()) { if (pair.PacientId == id) { var consultatie = new ConsultatieViewModel(); consultatie.Data = pair.Data; consultatie.Diagnostic = pair.Diagnostic; consultatie.DozaMedicament = pair.DozaMedicament; var medicament = medicamentData.Get(pair.MedicamentId); consultatie.NumeMedicament = medicament.Denumire; consultatii.Add(consultatie); } } model.Consultatii = consultatii; model.Medici = medics; model.Pacient = pacient; if (model == null) { return(View("NotFound")); } return(View(model)); }
public IActionResult Details(int id) { var model = new MedicamentPacientViewModel(); var medicament = medicamentData.Get(id); var pacients = new List <Pacient>(); foreach (var pair in consultatieData.GetAll()) { if (pair.MedicamentId == id) { var pacient = pacientData.Get(pair.PacientId); pacients.Add(pacient); } } model.Medicament = medicament; model.Pacients = pacients; if (model == null) { return(View("NotFound")); } return(View(model)); }