public bool CorrectCredentials(string clientId, string userLogin, string pass)
 {
     using (var context = new UserContext())
     {
         var passHash = HashWorker.GetHash(pass);
         return(context.Clients.Any(c => c.ClientId == clientId) &&
                context.Users.Any(u => u.Login == userLogin && u.PassHash == passHash));
     }
 }
        public User RegisterNewUser(string login, string name, string surname, string password)
        {
            using (var context = new UserContext())
            {
                var user = context.Users.Add(new User()
                {
                    Login = login, Name = name, Surname = surname, PassHash = HashWorker.GetHash(password)
                });
                context.SaveChanges();

                if (user != null)
                {
                    user.PassHash = "";
                }

                return(user);
            }
        }