public IActionResult Get()
        {
            // 1. Get all Encounters
            List <Encounter> resEnc = repo.Read();

            if (resEnc.Count > 0)
            {
                // 2. Get all People by Query
                List <Person> resUsr = repo.ReadQuery <Person>("GetAllPeople");

                // 3. Substitute resEnc.Person with a subset of resUsr for COVID Health Level
                if (resUsr.Count > 0)
                {
                    resEnc = resEnc.Select(e => {
                        List <Person> people = resUsr.Where(u => e.Person.Select(p => p.ID).Contains(u.ID)).ToList();
                        List <int> health    = people.Select(e => e.CovidHealthLevel).ToList();
                        e.Person             = people;
                        e.CovidRiskLevel     = health.Contains(3) ? 3 : health.Contains(2) ? 2 : 1;
                        return(e);
                    }).ToList();
                }
            }

            return(Ok(resEnc));
        }
        public IActionResult SubmitDiagnosis(ODataActionParameters parameter)
        {
            string ID = parameter["ID"].ToString();

            if (ID.Length > 0)
            {
                Person p = repo.Read(ID);

                if (p != null)
                {
                    // 1. Record current time
                    DateTime timeStampNow = DateTime.Now;

                    // 2. Instantiate new Diagnosis
                    InfectiousDisease d = new InfectiousDisease($"COVID19_{timeStampNow.ToString("HHmmssddMMyyyy")}");
                    d.Classification = "COVID-19";
                    d.DateDiagnosed  = timeStampNow;

                    // 3. Bind the newly created individual to the database
                    d.SetModel(p.Model);
                    d.Commit();

                    // 4. Associate the newly created individual to the desired person
                    p.Diagnosis.Add(d);
                    repo.Update(p);

                    return(Ok(d));
                }
            }

            return(BadRequest());
        }
 public IActionResult Get()
 {
     return(Ok(repo.Read()));
 }