예제 #1
0
        public async Task <bool> Do(string uid, Domain.Models.Doctor doctor)
        {
            await _client
            .Child("Doctor").Child(uid)
            .PutAsync(doctor);

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Add a patient to the database
        /// </summary>
        /// <param name="patient">A patient to be added to the database</param>
        public async Task <Models.Patient> AddPatientAsync(Models.Patient patient)
        {
            if (patient.PrimaryDoctor is null)
            {
                var dr        = _context.Doctors.First();
                var patientdr = new Domain.Models.Doctor(dr.Id, dr.Name);
                patient.PrimaryDoctor = patientdr;
            }
            var newPatient = new DataModel.Patient
            {
                Name      = patient.Name,
                Dob       = patient.DateOfBirth,
                DoctorId  = patient.PrimaryDoctor.Id,
                Ssn       = patient.SSN,
                Insurance = patient.InsuranceProvider
            };
            await _context.Patients.AddAsync(newPatient);

            await _context.SaveChangesAsync();

            patient.Id = newPatient.Id;
            return(patient);
        }