public Prescription Create(Prescription prescription) { return new PrescriptionRepository().Create(prescription); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { Prescription prescription = new Prescription(); prescription.Patient = SelectedPatient; prescription.Product = SelectedProduct; prescription.Prescriber = SelectedPrescriber; prescription.SIG = txtSig.Text; prescription.WrittenDate = txtWrittenDate.SelectedDate.Value; prescription.ExpirationDate = prescription.WrittenDate.Add(new TimeSpan(365,0,0,0)); Int32 refills; Int32.TryParse(txtRefills.Text, out refills); prescription.RefillsAllowed = refills; //Create the Fills prescription = new PrescriptionManager().Create(prescription); Fill fill = new Fill(); fill.Prescription = prescription; fill.RefillsAllowed = refills; Int32 writtenQty; Int32.TryParse(txtWrittenQty.Text, out writtenQty); fill.WrittenQty = writtenQty; fill.DispensedQty = writtenQty; fill.QueueState = QueueStates.RxEntry; fill.DispensedDate = DateTime.Today; var createdFill = new FillManager().Create(fill); //Submit the Fill new FillManager().Submit(createdFill); NavigationService.GoBack(); }