public IUser createUser(IUser entry)
        {
            IUser user = UsersTable.Create(entry, dbConn);

            if (user == null)
            {
                return(null);
            }

            user = UsersTable.Get(user.UserName, dbConn);
            if (user == null)
            {
                return(null);
            }

            if (user.UserId == 0)
            {
                Console.WriteLine("Error userid == 0");
            }

            return(user);
        }
Exemplo n.º 2
0
        public void FixtureSetup()
        {
            this.DatabaseName = this.GetType().Name + DateTime.UtcNow.ToString("yyyy_MM_dd__HH_mm_ss");

            this.ConnectionFactory(ConnectionStringTemplate)
            .Execute("CREATE DATABASE IF NOT EXISTS " + this.DatabaseName);

            var connectionStringBuilder = new MySqlConnectionStringBuilder(ConnectionStringTemplate)
            {
                Database = this.DatabaseName
            };

            this.connectionString = connectionStringBuilder.ConnectionString;

            if (this.createUsersTable)
            {
                using (var connection = this.ConnectionFactory().Create())
                {
                    connection.Open();
                    UsersTable.Create(connection);
                }
            }
        }