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