// GET: DashBoard/DashBoard public ActionResult Index() { ViewBag.menu = "inicio"; SessionInitialize(); LocationCAD cadPos = new LocationCAD(); LocationCEN cen = new LocationCEN(cadPos); IList <LocationEN> listLocations = cen.ReadAll(0, -1); ViewBag.numLocations = listLocations.Count; PractitionerCAD cadPrac = new PractitionerCAD(); PractitionerCEN cenPrac = new PractitionerCEN(cadPrac); IList <PractitionerEN> listPracticioners = cenPrac.ReadAll(0, -1); ViewBag.numPractitioners = listPracticioners.Count; PatientCAD cadPatient = new PatientCAD(); PatientCEN cenPatient = new PatientCEN(cadPatient); IList <PatientEN> listPatients = cenPatient.ReadAll(0, -1); ViewBag.numPatients = listPatients.Count; MedicationCAD cadMedication = new MedicationCAD(); MedicationCEN cenMedication = new MedicationCEN(cadMedication); IList <MedicationEN> listMedications = cenMedication.ReadAll(0, -1); ViewBag.numMedications = listMedications.Count; CarePlanCAD cadCarePlan = new CarePlanCAD(); CarePlanCEN cenCarePlan = new CarePlanCEN(cadCarePlan); IList <CarePlanEN> listCarePlans = cenCarePlan.ReadAll(0, -1); ViewBag.numCarePlans = listCarePlans.Count; GoalCAD cadGoal = new GoalCAD(); GoalCEN cenGoal = new GoalCEN(cadGoal); IList <GoalEN> listGoals = cenGoal.ReadAll(0, -1); ViewBag.numGoals = listGoals.Count; SpecialtyCAD cadSpecialty = new SpecialtyCAD(); SpecialtyCEN cenSpecialty = new SpecialtyCEN(cadSpecialty); IList <SpecialtyEN> listSpecialtys = cenSpecialty.ReadAll(0, -1); ViewBag.numSpecialtys = listSpecialtys.Count; EncounterCAD cadEncounter = new EncounterCAD(); EncounterCEN cenEncounter = new EncounterCEN(cadEncounter); IList <EncounterEN> listEncounters = cenEncounter.ReadAll(0, -1); ViewBag.numEncounters = listEncounters.Count; SessionClose(); return(View("~/Areas/DashBoard/Views/Home/DashBoard.cshtml")); }
public HttpResponseMessage ReadAll() { // CAD, CEN, EN, returnValue GoalRESTCAD goalRESTCAD = null; GoalCEN goalCEN = null; List <GoalEN> goalEN = null; List <GoalDTOA> returnValue = null; try { SessionInitializeWithoutTransaction(); goalRESTCAD = new GoalRESTCAD(session); goalCEN = new GoalCEN(goalRESTCAD); // Data // TODO: paginación goalEN = goalCEN.ReadAll(0, -1).ToList(); // Convert return if (goalEN != null) { returnValue = new List <GoalDTOA>(); foreach (GoalEN entry in goalEN) { returnValue.Add(GoalAssembler.Convert(entry, session)); } } } catch (Exception e) { if (e.GetType() == typeof(HttpResponseException)) { throw e; } else if (e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto")) { throw new HttpResponseException(HttpStatusCode.Forbidden); } else if (e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.DataLayerException)) { throw new HttpResponseException(HttpStatusCode.BadRequest); } else { throw new HttpResponseException(HttpStatusCode.InternalServerError); } } finally { SessionClose(); } // Return 204 - Empty if (returnValue == null || returnValue.Count == 0) { return(this.Request.CreateResponse(HttpStatusCode.NoContent)); } // Return 200 - OK else { return(this.Request.CreateResponse(HttpStatusCode.OK, returnValue)); } }