Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is the code I wound up using.</p> <pre><code>[WebMethod(EnableSession = true)] public PatientsResult GetPatientList(bool returnInactivePatients) { if (!IsLoggedIn()) { return new PatientsResult() { Success = false, LoggedIn = false, Message = "Not logged in" }; } Func&lt;IEnumerable&lt;PatientResult&gt;, IEnumerable&lt;PatientResult&gt;&gt; filterActive = patientList =&gt; returnInactivePatients ? patientList : patientList.Where(p =&gt; p.Status == "Active"); User u = (User)Session["user"]; return new PatientsResult() { Success = true, LoggedIn = true, Message = "", Patients = filterActive((from p in u.Practice.Patients select new PatientResult() { PhysicianID = p.PhysicianID, Status = p.Active ? "Active" : "Inactive", PatientIdentifier = p.PatientIdentifier, PatientID = p.PatientID, LastVisit = p.Visits.Count &gt; 0 ? p.Visits.Max(v =&gt; v.VisitDate).ToShortDateString() : "", Physician = (p.Physician == null ? "" : p.Physician.FirstName + " " + p.Physician == null ? "" : p.Physician.LastName).Trim(), })).ToList&lt;PatientResult&gt;() }; } public class Result { public bool Success { get; set; } public bool LoggedIn { get; set; } public string Message { get; set; } } public class PatientsResult : Result { public List&lt;PatientResult&gt; Patients { get; set; } } public class PatientResult { public int PatientID { get; set; } public string Status { get; set; } public string PatientIdentifier { get; set; } public string Physician { get; set; } public int? PhysicianID {get;set;} public string LastVisit { get; set; } } </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload