public static void UpdateConsultation(Consultation consultation)
        {
            SystemMedContainer context = new SystemMedContainer();

            context.Consultations.AddObject(consultation);
            context.ObjectStateManager.ChangeObjectState(consultation, EntityState.Modified);
            context.SaveChanges();

            //detaching the object - ablity to share between different contexts
            context.Detach(consultation);
        }
        public static void DeleteConsultation(Consultation consultation)
        {
            SystemMedContainer context = new SystemMedContainer();

            if (consultation.EntityState == EntityState.Detached)
            {
                context.Consultations.Attach(consultation);
            }
            context.Consultations.DeleteObject(consultation);
            context.SaveChanges();
        }
        public static void InsertConsultation(Consultation consultation)
        {
            SystemMedContainer context = new SystemMedContainer();

            if (consultation.EntityState != EntityState.Detached)
            {
                context.ObjectStateManager.ChangeObjectState(consultation, EntityState.Added);
            }
            else
            {
                context.Consultations.AddObject(consultation);
            }
            context.SaveChanges();
            //detaching the object - ablity to share between different contexts
            context.Detach(consultation);
        }