public void Delete(T entity) { using (var dataContext = new InternacContext()) { dataContext.Set <T>().Remove(entity); dataContext.SaveChanges(); } }
public void Edit(T entity) { using (var dataContext = new InternacContext()) { dataContext.Entry(entity).State = EntityState.Modified; dataContext.SaveChanges(); } }
public IQueryable <T> GetAll() { using (var dataContext = new InternacContext()) { IQueryable <T> query = dataContext.Set <T>(); return(query); } }
public IQueryable <T> Find(Expression <Func <T, bool> > predicate) { using (var dataContext = new InternacContext()) { IQueryable <T> query = dataContext.Set <T>().Where(predicate); return(query); } }
public void Add(T entity) { using (var dataContext = new InternacContext()) { dataContext.Set <T>().Add(entity); dataContext.SaveChanges(); } }