/// <summary>
        /// Method to check if a username already exists
        /// </summary>
        /// <param name="username">Username</param>
        /// <returns>Returns true if the username exists, otherwise false</returns>
        public static bool CheckUsername(string username)
        {
            string sql        = @"SELECT Id FROM dbo.Users WHERE Username = @Username;";
            var    parameters = new { Username = username };

            return(SqlDataAccess.CheckTableDataFromParameters(sql, parameters));
        }
예제 #2
0
        /// <summary>
        /// Method to check if a language name exists for a specific user id
        /// </summary>
        /// <param name="userid">User Id associated with the language</param>
        /// <param name="name">Name of the language</param>
        /// <returns>Returns true if the language name exists for the user id, otherwise false</returns>
        public static bool CheckDistinct(int userid, string name)
        {
            string sql        = @"SELECT Id FROM dbo.Languages WHERE Userid = @UserId AND Name = @Name;";
            var    parameters = new { UserId = userid, Name = name };

            return(SqlDataAccess.CheckTableDataFromParameters(sql, parameters));
        }