public List <Product> GetAsQueryable(Expression <Func <Product, bool> > predicate = null) { using (var _context = new MAppDataContext()) { if (predicate == null) { return(_context.Set <Product>().Include(s => s.Category).ToList()); } else { return(_context.Set <Product>().Include(s => s.Category).Where(predicate).ToList()); } } }
public Product Get(Expression <Func <Product, bool> > predicate = null) { using (var _context = new MAppDataContext()) { return(_context.Set <Product>().Include(s => s.Category).FirstOrDefault(predicate)); } }
public bool Exist(Expression <Func <Product, bool> > predicate) { using (var _context = new MAppDataContext()) { return(_context.Set <Product>().Any(predicate)); } }
public void DeleteMultiple(List <Product> entityList) { using (var _context = new MAppDataContext()) { _context.Set <Product>().RemoveRange(entityList); _context.SaveChanges(); } }