// GET: DashBoard/Patient public ActionResult Index() { IEnumerable <Patient> listPos = null; try { SessionInitialize(); PractitionerCAD cadPrac = new PractitionerCAD(); PractitionerCEN cenPrac = new PractitionerCEN(cadPrac); PatientCAD cad = new PatientCAD(); PatientCEN cen = new PatientCEN(cad); IList <PatientEN> listPosEn = cen.ReadAll(0, -1); listPos = new AssemblerPatient().ConvertListENToModel(listPosEn).ToList(); foreach (Patient p in listPos) { if (string.IsNullOrEmpty(p.Imagen)) { p.Imagen = "default.png"; } } SessionClose(); } catch (Exception ex) { TempData["resultado"] = Resources.textos.modelEmpty; TempData["ok"] = "warning"; } ViewBag.menu = "Patients"; return(View(listPos)); }
// GET: DashBoard/Patient/Edit/5 public ActionResult Edit(int id) { ViewBag.menu = "Patients"; PatientEN positionEN = null; Patient pos = null; try { SessionInitialize(); PatientCAD cadPos = new PatientCAD(); PatientCEN cen = new PatientCEN(cadPos); positionEN = cen.ReadOID(id); pos = new AssemblerPatient().ConvertENToModelUI(positionEN); SessionClose(); } catch (Exception ex) { ViewBag.error = "Error: " + ex.Message; } return(View(pos)); }