コード例 #1
0
        /// <summary>
        /// Checks if user with given password exists in the database
        /// </summary>
        /// <param name="_username">User name</param>
        /// <param name="_password">User password</param>
        /// <returns>True if user exist and password is correct</returns>
        public bool IsValid(string _username, string _password)
        {
            MainDataClassDataContext db = new MainDataClassDataContext();
            String _hashPassword = SHA1.Encode(_password);
            var record = from u in db.users
                         where u.email.ToString() == _username
                         && u.hash_password.ToString() == _hashPassword
                         select u;
            var user = record.SingleOrDefault();

            if (user != null)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
コード例 #2
0
 public TopicController()
 {
     this.db = new MainDataClassDataContext();
 }
コード例 #3
0
 public UserController()
 {
     dbContext = new DAO.MainDataClassDataContext();
 }
コード例 #4
0
 public RoomsController()
 {
     this.db = new MainDataClassDataContext();
 }