Beispiel #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);
        }
Beispiel #2
0
 public BaseRepository(ETicaretContext context)
 {
     Context = context;
     Entity  = context.Set <T>();
 }
Beispiel #3
0
 public DbSet <T> Set()
 {
     return(_db.Set <T>());
 }
Beispiel #4
0
 public DbSet <T> GetTable()
 {
     return(_context.Set <T>());
 }