public void UpdatePatient(Patient p) { using (var db = new DrConsoleDB()) { db.PatientsDB.AddOrUpdate(p); db.SaveChanges(); } }
public void UpdateDrug(Drug d) { using (var db = new DrConsoleDB()) { db.DrugsDB.AddOrUpdate(d); db.SaveChanges(); } }
public void UpdateAdmin(Admin a) { using (var db = new DrConsoleDB()) { db.AdminsDB.AddOrUpdate(a); db.SaveChanges(); } }
public void UpdateDoctor(Doctor d) { using (var db = new DrConsoleDB()) { db.DoctorsDB.AddOrUpdate(d); db.SaveChanges(); } }
public void DeleteAdmin(Admin admin) { using (var db = new DrConsoleDB()) { db.Entry(admin).State = EntityState.Deleted; db.SaveChanges(); } }
public void DeletePatient(Patient patient) { using (var db = new DrConsoleDB()) { db.Entry(patient).State = EntityState.Deleted; db.SaveChanges(); } }
public void DeleteDoctor(Doctor doctor) { using (var db = new DrConsoleDB()) { db.Entry(doctor).State = EntityState.Deleted; db.SaveChanges(); } }
public void AddActiveIngredient(ActiveIngredient active) { using (var db = new DrConsoleDB()) { db.ActiveIngredientsDB.Add(active); db.SaveChanges(); } }
public void DeleteActiveIngredient(ActiveIngredient active) { using (var db = new DrConsoleDB()) { db.Entry(active).State = EntityState.Deleted; 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 AddDoctor(Doctor doctor) { using (var db = new DrConsoleDB()) { db.DoctorsDB.Add(doctor); db.SaveChanges(); } }
public void AddAdmin(Admin admin) { using (var db = new DrConsoleDB()) { db.AdminsDB.Add(admin); 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(); } }