示例#1
0
    public String Create_User_Login(string txtFName, string txtLName, string txtPhoneNo, string txtMobileNo, string txtEMail, string txtAddress, string txtUsername, string txtCountry, string comboUserType)
    {
        CreateUserLogin UL = new CreateUserLogin();
        String          s  = UL.CreateUser(txtFName, txtLName, txtPhoneNo, txtMobileNo, txtEMail, txtAddress, txtUsername, txtCountry, comboUserType);

        return(s);
    }
示例#2
0
        public async Task <IActionResult> CreateAsync([FromBody] CreateUserLogin userEntity)
        {
            var createdUserLogin = await userLoginRepository.CreateUserLoginAsync(userEntity);

            if (createdUserLogin == null)
            {
                return(NotFound());
            }

            return(Ok(createdUserLogin.ApiGetUser()));
        }
示例#3
0
        public int CreateUserLogin(CreateUserLogin user, string passwordSalt, string passwordHash, int forumUserID, int gameUserID)
        {
            UserLogin insertUser = new UserLogin()
            {
                Username     = user.Username,
                Email        = user.Email,
                PasswordSalt = passwordSalt,
                PasswordHash = passwordHash,
                ForumUserID  = forumUserID,
                GameUserID   = gameUserID
            };

            insertUser.WhenCreated = DateTime.UtcNow;
            dbContext.UserLogin.Add(insertUser);
            dbContext.SaveChanges();
            return(insertUser.UserLoginID);
        }
示例#4
0
        public Task <UserLogin> CreateUserLoginAsync(CreateUserLogin userEntity)
        {
            return(Task.Run(() => {
                if (GetUserLogin(userEntity.Username) != null)
                {
                    return null;
                }
                if (GetUserLoginByEmail(userEntity.Email) != null)
                {
                    return null;
                }

                string passwordSalt = Authentication.GenerateSalt();
                string hashPassword = Authentication.HashPassword(userEntity.Password, passwordSalt);

                var forumUserID = forumUserRepository.CreateForumUser();
                var gameUserID = gameUserRepository.CreateGameUser();
                var userLoginID = CreateUserLogin(userEntity, passwordSalt, hashPassword, forumUserID, gameUserID);

                return GetUserLogin(userLoginID);
            }));
        }