private void button2_Click(object sender, EventArgs e) { EMR emr = Service.DoctorService.FindEMRbyID(new Guid(textBox1.Text)); IEMRRepository eMRRepository = new EMRRepository(Service.dbcontext); eMRRepository.Remove(emr); Service.dbcontext.SaveChanges(); MessageBox.Show("删除成功"); }
public BaseService(HappContext dbContext) { emrRepository = new EMRRepository(dbContext); codeRepository = new CodeRepository(dbContext); queriseRepository = new QueriseRepository(dbContext); sessionRepository = new SessionRepository(dbContext); doctorRepository = new DoctorRepository(dbContext); patientRepository = new PatientRepository(dbContext); }
static void Main(string[] args) { HappContext dbContext = new HappContext(); IEMRRepository eMRRepository = new EMRRepository(dbContext); ISessionRepository sessionRepository = new SessionRepository(dbContext); EMR eMR = new EMR() { ID = Guid.NewGuid(), Ppubkey = "P@u0d?#1N3z" }; eMRRepository.Add(eMR); dbContext.SaveChanges(); }