Beispiel #1
0
        /// <summary>
        /// Updates the password.
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>

        public bool UpdatePassword(string userName, string password)
        {
            using (AuthenticationEntities authEntity = new AuthenticationEntities())
            {
                AuthDetail table = authEntity.AuthDetails.Find(userName);

                if (table == null)
                {
                    return(false);
                }
                else
                {
                    table.password = password;
                    authEntity.SaveChanges();
                    return(true);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Adds the UserName and Password.
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="password"></param>
 public bool StoreCredentials(string username, string password)
 {
     using (AuthenticationEntities authEntity = new AuthenticationEntities())
     {
         try
         {
             AuthDetail table = new AuthDetail();
             table.username = username;
             table.password = password;
             authEntity.AuthDetails.Add(table);
             authEntity.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
             return(false);
         }
     }
 }