Exemplo n.º 1
0
 public T Insert <T>(T model) where T : class
 {
     using (AdapterDesignContext adapterDesignContext = new AdapterDesignContext())
     {
         adapterDesignContext.Set <T>().Add(model);
         adapterDesignContext.SaveChanges();
     }
     return(model);
 }
Exemplo n.º 2
0
        public void Delete <T>(int id) where T : class
        {
            T model = Find <T>(id);

            using (AdapterDesignContext adapterDesignContext = new AdapterDesignContext())
            {
                adapterDesignContext.Set <T>().Remove(model);
                adapterDesignContext.SaveChanges();
            }
        }