public TransactionRepository(DbContextEntities dbContext, DbSet <Transactions> dbSetTransactions, DbSet <Compte> dbSetCompte) { this.dbContext = dbContext; this.dbSetTransactions = dbSetTransactions; this.dbSetCompte = dbSetCompte; }
public override string[] GetRolesForUser(string username) //public string[] GetRolesForUser(string username) { using (DbContextEntities db = new DbContextEntities()) { var objUser = db.users.FirstOrDefault(x => x.username == username); user usr = db.users.FirstOrDefault(u => u.username.Equals(username, StringComparison.CurrentCultureIgnoreCase) || u.username.Equals(username, StringComparison.CurrentCultureIgnoreCase)); var roles = from ur in db.users from r in db.access_level where ur.access_level == r.accesslevel select r.accesslevel_desc; if (objUser == null) { return(null); } else { //string[] ret = objUser.access_level.ToString( return(null); } /* * if (roles != null) * return roles.ToArray(); * else * return new string[] { }; */ } }
public override string[] GetAllRoles() /// public string[] GetAllRoles() { using (var DbContextEntities = new DbContextEntities()) { return(DbContextEntities.access_level.Select(r => r.accesslevel_desc).ToArray()); } }
public TransfertRepository(DbContextEntities dbContext, DbSet <Transfert> dbSetTransfert, DbSet <Compte> dbSetCompte) { this.dbContext = dbContext; this.dbSetCompte = dbSetCompte; this.dbSetTransfert = dbSetTransfert; }
public void Dispose(bool disposing) { if (disposing) { if (_context != null) { _context.Dispose(); _context = null; } } }
public static DbContext GetCuurentDbContext() { DbContext db = HttpContext.Current.Items["DbContext"] as DbContext; if (db == null) { db = new DbContextEntities(); HttpContext.Current.Items.Add("DbContext", db); } return(db); }
public override bool IsUserInRole(string username, string roleName) ///public bool IsUserInRole(string username, string roleName) { using (DbContextEntities db = new DbContextEntities()) { user usr = db.users.FirstOrDefault(u => u.username.Equals(username, StringComparison.CurrentCultureIgnoreCase) || u.device_id.Equals(roleName, StringComparison.CurrentCultureIgnoreCase)); var roles = from ur in db.users from r in db.access_level where ur.access_level == r.accesslevel select r.accesslevel_desc; if (usr != null) { return(roles.Any(r => r.Equals(roleName, StringComparison.CurrentCultureIgnoreCase))); } else { return(false); } } }
public TransactionRepository(DbContextEntities dbContext) { dbSetCompte = dbContext.Compte; dbSetTransactions = dbContext.Transactions; }
public CowRepository() { db = new DbContextEntities(); }
public TransactionRepository() { this.dbContext = new DbContextEntities(); dbSetCompte = dbContext.Compte; dbSetTransactions = dbContext.Transactions; }
public PredictionRepository() { db = new DbContextEntities(); }
public TransactionsService(DbContextEntities dbContext, DbSet <Transactions> dbSetTransactions, DbSet <Compte> dbSetCompte) { transactionRepository = new TransactionRepository(dbContext, dbSetTransactions, dbSetCompte); }
public TransfertRepository() { dbContext = new DbContextEntities(); dbSetCompte = dbContext.Compte; dbSetTransfert = dbContext.Transfert; }
public TransfertService(DbContextEntities dbContext, DbSet <Transfert> dbSetTransfert, DbSet <Compte> dbSetCompte) { transfertRepository = new TransfertRepository(dbContext, dbSetTransfert, dbSetCompte); }
public UnitOfWork(DbContextEntities context) { this._context = new DbContextEntities(); }
public NotificationRepository() { db = new DbContextEntities(); }
public LactationRepository() { db = new DbContextEntities(); }
public FoodRepository() { db = new DbContextEntities(); }