public void Delete(Appointment appt)
 {
     //delete consultation also
     foreach (Consultation cs in appt.Consultations.ToList())
         db.Consultations.DeleteObject(cs);
     db.Appointments.DeleteObject(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="reason">Initial value of the Reason 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.String reason, global::System.DateTime fromTime, global::System.DateTime toTime, global::System.Int32 doctorID)
 {
     Appointment appointment = new Appointment();
     appointment.Appointmentid = appointmentid;
     appointment.Patientid = patientid;
     appointment.Reason = reason;
     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);
 }