예제 #1
0
 public List <Prescription> GetList()
 {
     using (var ctx = new PrescriptionDATA())
     {
         return(ctx.Prescription.ToList());
     }
 }
예제 #2
0
        public void Add(List <MedicineTimes> medicines, Prescription prescription)
        {
            Doctor  doctor  = new Doctor(GetDoctor(prescription));
            Patient patient = new Patient(GetPatient(prescription));

            using (var ctx = new PrescriptionDATA())
            {
                foreach (var item in medicines)
                {
                    PrescriptionMedicine medicine = new PrescriptionMedicine(patient.TZ, item.MyMedicine.ProprietaryName, item.StartTime, item.EndTime);
                    Prescription         p        = new Prescription(patient, doctor, medicine);
                    ctx.Prescription.Add(p);
                    ctx.SaveChanges();
                }
            }
        }