Exemple #1
0
 public User GetByEmail(string email)
 {
     using (var context = new URLContext(_connectionString))
     {
         return(context.Users.FirstOrDefault(u => u.Email == email));
     }
 }
Exemple #2
0
        public void AddUser(User user, string password)
        {
            user.Password = PasswordEncryption.HashPassword(password);

            using (var context = new URLContext(_connectionString))
            {
                context.Users.Add(user);
                context.SaveChanges();
            }
        }