public ActionResult PatientsPerVisitPerClinic(string studyState, int stateNumber) { IList<PatientStateDto> data = patientRepository.GetPatientsStateData(); var query = from stateData in data where EnumHelper.GetDescription(stateData.VisitType) == studyState group stateData by stateData.ClinicName into gr orderby gr.Key select new PatientStateViewModel { StudyState = studyState, EntityCaption = gr.Key, PatientsNumber = gr.Count() }; var model = new PatientStateList { PatientState = studyState, PatientStateColorNumber = stateNumber }; model.AddRange(query.ToList()); if (Request.IsAjaxRequest()) return PartialView("_PatientsPerVisitPerClinic", model); return View("PatientsPerVisitPerClinic", model); }
public ActionResult PatientsPerVisit() { IList<PatientStateDto> data = patientRepository.GetPatientsStateData(); var query = from stateData in data orderby stateData.VisitTypeValue group stateData by stateData.VisitType into gr select new PatientStateViewModel { SortingKey = (int) gr.Key, StudyState = EnumHelper.GetDescription(gr.Key), PatientsNumber = gr.Count() }; var model = new PatientStateList(); model.AddRange(query.ToList()); if (Request.IsAjaxRequest()) return PartialView("_PatientsPerVisit", model); return View("PatientsPerVisit", model); }