Beispiel #1
0
 public List <T> GetList <T>() where T : class
 {
     using (FLMSEntities entities = new FLMSEntities())
     {
         return(entities.Set <T>().ToList());
     }
 }
Beispiel #2
0
 public void SaveOrUpdate <T>(T t, int id) where T : class
 {
     using (FLMSEntities entities = new FLMSEntities())
     {
         if (id == 0)
         {
             entities.Set <T>().Add(t);
             entities.SaveChanges();
         }
         else
         {
             entities.Entry(t).State = EntityState.Modified;
             entities.SaveChanges();
         }
     }
 }