public Patient GetPatient(string patientId) { using (var db = new DrConsoleDB()) { return((from p in db.PatientsDB where p.ID.Equals(patientId) select p).FirstOrDefault()); } }
public List <Prescription> GetAllPrescriptions() { using (var db = new DrConsoleDB()) { return((from p in db.PrescriptionDB select p).ToList()); } }
public List <Doctor> GetAllDoctors() { using (var db = new DrConsoleDB()) { return((from d in db.DoctorsDB select d).ToList()); } }
public List <ActiveIngredient> GetAllActiveIngredients() { using (var db = new DrConsoleDB()) { return((from a in db.ActiveIngredientsDB select a).ToList()); } }
public List <Patient> GetAllPatients() { using (var db = new DrConsoleDB()) { return((from p in db.PatientsDB select p).ToList()); } }
public Doctor GetDoctor(string doctorId) { using (var db = new DrConsoleDB()) { return((from d in db.DoctorsDB where d.ID.Equals(doctorId) select d).FirstOrDefault()); } }
public List <Drug> GetAllDrugs() { using (var db = new DrConsoleDB()) { return((from d in db.DrugsDB select d).ToList()); } }
public List <Admin> GetAllAdmins() { using (var db = new DrConsoleDB()) { return((from a in db.AdminsDB select a).ToList()); } }
public Drug GetDrug(string drugName) { using (var db = new DrConsoleDB()) { return((from d in db.DrugsDB where d.DrugName.Equals(drugName) select d).FirstOrDefault()); } }
public void DeleteDoctor(Doctor doctor) { using (var db = new DrConsoleDB()) { db.Entry(doctor).State = EntityState.Deleted; db.SaveChanges(); } }
public void AddDoctor(Doctor doctor) { using (var db = new DrConsoleDB()) { db.DoctorsDB.Add(doctor); db.SaveChanges(); } }
public void DeletePatient(Patient patient) { using (var db = new DrConsoleDB()) { db.Entry(patient).State = EntityState.Deleted; db.SaveChanges(); } }
public void DeleteAdmin(Admin admin) { using (var db = new DrConsoleDB()) { db.Entry(admin).State = EntityState.Deleted; db.SaveChanges(); } }
public void DeleteActiveIngredient(ActiveIngredient active) { using (var db = new DrConsoleDB()) { db.Entry(active).State = EntityState.Deleted; db.SaveChanges(); } }
public void AddActiveIngredient(ActiveIngredient active) { using (var db = new DrConsoleDB()) { db.ActiveIngredientsDB.Add(active); db.SaveChanges(); } }
public void AddPrescription(Prescription prescription) { using (var db = new DrConsoleDB()) { db.PrescriptionDB.Add(prescription); db.SaveChanges(); } }
public void AddPatient(Patient patient) { using (var db = new DrConsoleDB()) { db.PatientsDB.Add(patient); db.SaveChanges(); } }
public void UpdateDrug(Drug d) { using (var db = new DrConsoleDB()) { db.DrugsDB.AddOrUpdate(d); db.SaveChanges(); } }
public void AddAdmin(Admin admin) { using (var db = new DrConsoleDB()) { db.AdminsDB.Add(admin); db.SaveChanges(); } }
public void UpdatePatient(Patient p) { using (var db = new DrConsoleDB()) { db.PatientsDB.AddOrUpdate(p); db.SaveChanges(); } }
public void UpdateDoctor(Doctor d) { using (var db = new DrConsoleDB()) { db.DoctorsDB.AddOrUpdate(d); db.SaveChanges(); } }
public void UpdateAdmin(Admin a) { using (var db = new DrConsoleDB()) { db.AdminsDB.AddOrUpdate(a); db.SaveChanges(); } }
public void DeleteDrug(Drug drug) { try { System.IO.File.Delete(drug.ImgSrc); } catch { } using (var db = new DrConsoleDB()) { db.Entry(drug).State = EntityState.Deleted; db.SaveChanges(); } }
public void AddDrug(Drug drug) { string newImagePath = @"..\..\Global\Images\DrugImages\" + drug.DrugName + RandomString() + @".jpg"; (System.IO.File.Create(newImagePath)).Close(); System.IO.File.Copy(drug.ImgSrc, newImagePath, true); drug.ImgSrc = newImagePath; using (var db = new DrConsoleDB()) { db.DrugsDB.Add(drug); db.SaveChanges(); } }