/// <summary>
        /// Convert a report from a db object to a domain model object.
        /// </summary>
        /// <remarks>
        /// Will not get patient or vitals.
        /// </remarks>
        /// <param name="report">The report from the db</param>
        /// <returns></returns>
        public static Models.PatientReport MapReport(DataModel.PatientReport report)
        {
            if (report is null)
            {
                throw new ArgumentNullException("MapReport Report is null.");
            }

            Models.PatientReport modelreport = new Models.PatientReport(report.Id, report.Information);

            modelreport.Time      = report.ReportTime;
            modelreport.PatientId = report.PatientId;

            return(modelreport);
        }
Esempio n. 2
0
        /// <summary>
        /// Add a patient report to the database
        /// </summary>
        /// <param name="report">The report to be added tp the database</param>
        public Models.PatientReport AddPatientReport(Models.PatientReport report)
        {
            var newPatientReport = new DataModel.PatientReport
            {
                PatientId   = report.PatientId,
                ReportTime  = report.Time,
                Information = report.Info
                              //add vitals id for datamodel??
            };

            _context.Add(newPatientReport);
            _context.SaveChanges();
            report.Id = newPatientReport.Id;
            return(report);
        }
Esempio n. 3
0
        /// <summary>
        /// Add a patient report to the database
        /// </summary>
        /// <param name="report">The report to be added tp the database</param>
        public async Task <Models.PatientReport> AddPatientReportAsync(Models.PatientReport report)
        {
            var newPatientReport = new DataModel.PatientReport
            {
                PatientId   = report.PatientId,
                ReportTime  = report.Time,
                Information = report.Info
            };

            await _context.AddAsync(newPatientReport);

            await _context.SaveChangesAsync();

            report.Id = newPatientReport.Id;
            return(report);
        }