示例#1
0
        /// <summary>
        /// Add initial patients with covid
        /// </summary>
        private List <Patient> AddPeopleWithCovidAlready()
        {
            string solutionDir = fileRepository.ReturnInitialCovidPatientPath();

            PatientsCollection patientsDeserialized = fileRepository.ReturnPatientsCollectionByReadingXml(solutionDir);

            return(patientsDeserialized.Patients);
        }
        /// <summary>
        /// Reads an xml and returns the deserialized object
        /// </summary>
        /// <param name="path">The path of the xml</param>
        /// <returns>A Collection of patients</returns>
        public PatientsCollection ReturnPatientsCollectionByReadingXml(string path)
        {
            PatientsCollection xmlDeserialized = null;
            XmlSerializer      serializer      = new XmlSerializer(typeof(PatientsCollection));

            using (StreamReader sw = new StreamReader(path))
            {
                xmlDeserialized = (PatientsCollection)serializer.Deserialize(sw);
            }

            return(xmlDeserialized);
        }