public static void DeleteDiagnosisById(int diagnosisId) { SystemMedContainer context = new SystemMedContainer(); var diagnosis = context.Diagnoses.Where(p => p.DiagnoseId == diagnosisId).FirstOrDefault(); context.Diagnoses.DeleteObject(diagnosis); context.SaveChanges(); }
public static void UpdateDoctor(Doctor doctor) { SystemMedContainer context = new SystemMedContainer(); context.Doctors.AddObject(doctor); context.ObjectStateManager.ChangeObjectState(doctor, EntityState.Modified); context.SaveChanges(); }
public static void UpdateDiagnosis(Diagnosis diagnosis) { SystemMedContainer context = new SystemMedContainer(); context.Diagnoses.AddObject(diagnosis); context.ObjectStateManager.ChangeObjectState(diagnosis, EntityState.Modified); context.SaveChanges(); }
public static void UpdateUser(User user) { SystemMedContainer context = new SystemMedContainer(); context.Users.AddObject(user); context.ObjectStateManager.ChangeObjectState(user, EntityState.Modified); context.SaveChanges(); }
public static void DeleteUserById(int userId) { SystemMedContainer context = new SystemMedContainer(); var user = context.Users.Where(p => p.UserId == userId).FirstOrDefault(); context.Users.DeleteObject(user); context.SaveChanges(); }
public static void DeleteDoctorById(int doctorId) { SystemMedContainer context = new SystemMedContainer(); var doctor = context.Doctors.Where(p => p.DoctorId == doctorId).FirstOrDefault(); context.Doctors.DeleteObject(doctor); context.SaveChanges(); }
public static void DeletePatientById(int patientId) { SystemMedContainer context = new SystemMedContainer(); var patient = context.Patients.Where(p => p.PatientId == patientId).FirstOrDefault(); context.Patients.DeleteObject(patient); context.SaveChanges(); }
public static void DeleteConsultationById(int consultationId) { SystemMedContainer context = new SystemMedContainer(); var consultation = context.Consultations.Where(p => p.ConsultationId == consultationId).FirstOrDefault(); context.Consultations.DeleteObject(consultation); context.SaveChanges(); }
public static void UpdatePatient(Patient patient) { SystemMedContainer context = new SystemMedContainer(); context.Patients.AddObject(patient); context.ObjectStateManager.ChangeObjectState(patient, EntityState.Modified); context.SaveChanges(); //detach because object is stateless context.Detach(patient); }
public static void DeleteUser(User user) { SystemMedContainer context = new SystemMedContainer(); if (user.EntityState == EntityState.Detached) { context.Users.Attach(user); } context.Users.DeleteObject(user); context.SaveChanges(); }
public static void DeleteDoctor(Doctor doctor) { SystemMedContainer context = new SystemMedContainer(); if (doctor.EntityState == EntityState.Detached) { context.Doctors.Attach(doctor); } context.Doctors.DeleteObject(doctor); context.SaveChanges(); }
public static void DeletePatient(Patient patient) { SystemMedContainer context = new SystemMedContainer(); if (patient.EntityState == EntityState.Detached) { context.Patients.Attach(patient); } context.Patients.DeleteObject(patient); context.SaveChanges(); }
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 DeleteDiagnosis(Diagnosis diagnosis) { SystemMedContainer context = new SystemMedContainer(); if (diagnosis.EntityState == EntityState.Detached) { context.Diagnoses.Attach(diagnosis); } context.Diagnoses.DeleteObject(diagnosis); context.SaveChanges(); }
public static void InsertDoctor(Doctor doctor) { SystemMedContainer context = new SystemMedContainer(); if (doctor.EntityState != EntityState.Detached) { context.ObjectStateManager.ChangeObjectState(doctor, EntityState.Added); } else { context.Doctors.AddObject(doctor); } context.SaveChanges(); }
public static void InsertUser(User user) { SystemMedContainer context = new SystemMedContainer(); if (user.EntityState != EntityState.Detached) { context.ObjectStateManager.ChangeObjectState(user, EntityState.Added); } else { context.Users.AddObject(user); } context.SaveChanges(); }
public static void InsertDiagnosis(Diagnosis diagnosis) { SystemMedContainer context = new SystemMedContainer(); if (diagnosis.EntityState != EntityState.Detached) { context.ObjectStateManager.ChangeObjectState(diagnosis, EntityState.Added); } else { context.Diagnoses.AddObject(diagnosis); } 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); }
public static void InsertPatient(Patient patient) { SystemMedContainer context = new SystemMedContainer(); if (patient.EntityState != EntityState.Detached) { context.ObjectStateManager.ChangeObjectState(patient, EntityState.Added); } else { context.Patients.AddObject(patient); } context.SaveChanges(); //detach because object is stateless context.Detach(patient); }