public List <T> LoadAllItems <T>() where T : class { using (var dbContext = new PEISEntities()) { return(dbContext.Set <T>().ToList()); } }
public T Load <T>(Expression <Func <T, bool> > whereLambda) where T : class { using (var dbContext = new PEISEntities()) { return(dbContext.Set <T>().Where(whereLambda).FirstOrDefault()); } }
public List <T> LoadAll <T>(Expression <Func <T, bool> > whereLambda) where T : class { using (var dbContext = new PEISEntities()) { return(dbContext.Set <T>().Where(whereLambda).ToList()); } }
public bool Insert <T>(T t) where T : class { using (var dbContext = new PEISEntities()) { dbContext.Set <T>().Add(t); if (dbContext.SaveChanges() != 0) { return(true); } } return(false); }