public List <T> GetList <T>() where T : class { using (FLMSEntities entities = new FLMSEntities()) { return(entities.Set <T>().ToList()); } }
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(); } } }