public virtual bool Exists(Func <T, bool> where) { using (var context = new BtgDbContext()) { return(context .Set <T>() .Any(where)); } }
public Ordem GetOne(Func <Ordem, bool> where) { using (var context = new BtgDbContext()) { return(context .Set <Ordem>() .AsNoTracking() .FirstOrDefault(where)); } }
public IList <Ordem> GetAll() { using (var context = new BtgDbContext()) { return(context .Set <Ordem>() .AsNoTracking() .ToList()); } }
public virtual IList <T> GetAll() { using (var context = new BtgDbContext()) { return(context .Set <T>() .AsNoTracking() .ToList()); } }
public virtual T GetOne(Func <T, bool> where) { using (var context = new BtgDbContext()) { return(context .Set <T>() .AsNoTracking() .FirstOrDefault(where)); } }
public IList <Ordem> Get(Func <Ordem, bool> where) { using (var context = new BtgDbContext()) { return(context .Set <Ordem>() .AsNoTracking() .Where(where) .ToList()); } }
public virtual IList <T> Get(Func <T, bool> where) { using (var context = new BtgDbContext()) { return(context .Set <T>() .AsNoTracking() .Where(where) .ToList()); } }
public bool TryAdd(params Ordem[] items) { using (var context = new BtgDbContext()) { foreach (var item in items) { context.Entry(item).State = EntityState.Added; } context.SaveChanges(); return(true); } }
public virtual bool TryDelete(params T[] items) { using (var context = new BtgDbContext()) { try { foreach (var item in items) { context.Entry(item).State = EntityState.Deleted; } context.SaveChanges(); return(true); } catch (Exception) { throw; } } }