public void Delete(Appointment appt)
 {
     //delete consultation also
     foreach (Consultation cs in appt.Consultations.ToList())
         db.Consultations.DeleteObject(cs);
     db.Appointments.DeleteObject(appt);
 }
 public static Appointment CreateTestAppointment()
 {
     Appointment appt = new Appointment()
     {
         Appointmentid = 6,
         Patientid = 1,
         Reason = "sample Reason",
         FromTime = new DateTime(),
         ToTime = new DateTime(),
         DoctorID = 1
     };
     return appt;
 }
        public static List<Appointment> CreateTestAppointments()
        {
            List<Appointment> appointments = new List<Appointment>();

            for (int i = 0; i < 5; i++ )
            {
                Appointment appt = new Appointment()
                {
                 Appointmentid = i,
                 Patientid = i,
                 Reason = "sample Reason",
                 FromTime = new DateTime(),
                 ToTime =  new DateTime(),
                 DoctorID = i
             };

                appointments.Add(appt);
            }
            return appointments;
        }
 public void Delete(Appointment appt)
 {
     appointmentRepository.Delete(appt);
 }
 public void Add(Appointment appt)
 {
     appointmentRepository.Add(appt);
 }
 public void Delete(Appointment appt)
 {
 }
 public void Add(Appointment appt)
 {
     appointmentList.Add(appt);
 }
 /// <summary>
 /// Create a new Appointment object.
 /// </summary>
 /// <param name="appointmentid">Initial value of the Appointmentid property.</param>
 /// <param name="patientid">Initial value of the Patientid property.</param>
 /// <param name="fromTime">Initial value of the FromTime property.</param>
 /// <param name="toTime">Initial value of the ToTime property.</param>
 /// <param name="doctorID">Initial value of the DoctorID property.</param>
 public static Appointment CreateAppointment(global::System.Int32 appointmentid, global::System.Int32 patientid, global::System.DateTime fromTime, global::System.DateTime toTime, global::System.Int32 doctorID)
 {
     Appointment appointment = new Appointment();
     appointment.Appointmentid = appointmentid;
     appointment.Patientid = patientid;
     appointment.FromTime = fromTime;
     appointment.ToTime = toTime;
     appointment.DoctorID = doctorID;
     return appointment;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Appointments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAppointments(Appointment appointment)
 {
     base.AddObject("Appointments", appointment);
 }
 public void Add(Appointment appt)
 {
     db.Appointments.AddObject(appt);
     db.SaveChanges();
 }