Exemplo n.º 1
0
        public static int RegisterUser(string username, string password, string email, string countryName)
        {
            int       flag      = 0;
            UserDB    userDB    = new UserDB();
            CountryDB countryDB = new CountryDB();
            Country   country   = countryDB.SelectByName(countryName);

            if (country != null)
            {
                User newUser = new User();
                newUser.Username    = username;
                newUser.Password    = password;
                newUser.Email       = email;
                newUser.CountryName = countryName;

                bool s = userDB.InsertUser(newUser);
                if (s)
                {
                    flag = 1;
                }
                else
                {
                    flag = 0;
                }
            }
            return(flag);
        }