Beispiel #1
0
        public static Medic GetMedic(this Models.ForApi.Medic apiMedic, Models.ForApi.Login apiLogin, List <Models.ForApi.Patient> patients)
        {
            Medic medic = new Medic();

            medic.Name           = apiMedic.Name;
            medic.Surname        = apiMedic.Surname;
            medic.Age            = apiMedic.Age;
            medic.Phone          = apiMedic.Phone;
            medic.Address        = apiMedic.Address;
            medic.Specialization = apiMedic.Specialization;
            medic.Email_notify   = apiMedic.Email_notify;
            medic.Sms_notify     = apiMedic.Sms_notify;

            medic.Email = apiLogin.Email;

            foreach (Models.ForApi.Patient p in patients)
            {
                if (p.Id != 0)
                {
                    medic.Patients.Add(new PatientsForMedic(p.Id, p.Name, p.Surname));
                }
            }

            return(medic);
        }
Beispiel #2
0
        public static Patient GetPatient(this Models.ForApi.Patient apiPatient, Models.ForApi.PatientInitial patientInitial, Models.ForApi.Login login, List <Models.ForApi.Medic> medics)
        {
            Patient patient = new Patient();

            patient.Name             = apiPatient.Name;
            patient.Surname          = apiPatient.Surname;
            patient.Age              = apiPatient.Age;
            patient.Phone            = apiPatient.Phone;
            patient.Address_home     = apiPatient.Address_home;
            patient.Address_hospital = apiPatient.Address_hospital;
            patient.Email_notify     = apiPatient.Email_notify;
            patient.Sms_notify       = apiPatient.Sms_notify;

            patient.Pregnancy_start_date = patientInitial.Pregnancy_start_date;
            patient.Weight = patientInitial.Weight;
            patient.Height = patientInitial.Height;
            patient.Bmi    = patientInitial.Bmi;
            patient.Twin   = patientInitial.Twin;

            patient.Email = login.Email;

            foreach (Models.ForApi.Medic medic in medics)
            {
                if (medic.Id != 0)
                {
                    patient.Medics.Add(new MedicsForPatient(medic.Id, medic.Name, medic.Surname, medic.Specialization));
                }
            }

            return(patient);
        }