Exemple #1
0
        public void Delete(object id)
        {
            ClinicSystemContext con = new ClinicSystemContext();
            T del = con.Set <T>().Find(id);

            con.Set <T>().Remove(del);
            con.SaveChanges();
        }
Exemple #2
0
        public void Insert(T obj)
        {
            ClinicSystemContext con = new ClinicSystemContext();

            con.Set <T>().Add(obj);
            con.SaveChanges();
        }
Exemple #3
0
        public void Update(T obj)
        {
            ClinicSystemContext con = new ClinicSystemContext();

            con.Set <T>().Attach(obj);
            con.Entry(obj).State = EntityState.Modified;
            con.SaveChanges();
        }
Exemple #4
0
        public List <T> LoadAll()
        {
            ClinicSystemContext con = new ClinicSystemContext();

            return(con.Set <T>().ToList <T>());
        }
Exemple #5
0
        public T Load(int id)
        {
            ClinicSystemContext con = new ClinicSystemContext();

            return(con.Set <T>().Find(id));
        }