예제 #1
0
        public User Authenticate(string username, string password)
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                return(null);
            }

            var user = _context.Set <User>().FirstOrDefault(x => x.UserName == username);

            // check if username exists
            if (user == null)
            {
                return(null);
            }

            // check if password is correct
            if (!VerifyPasswordHash(password, user.PasswordHash, user.PasswordSalt))
            {
                return(null);
            }


            // authentication successful
            return(user);
        }
예제 #2
0
 public BaseRepository(ETicaretContext context)
 {
     Context = context;
     Entity  = context.Set <T>();
 }
예제 #3
0
 public DbSet <T> Set()
 {
     return(_db.Set <T>());
 }
예제 #4
0
 public DbSet <T> GetTable()
 {
     return(_context.Set <T>());
 }