Esempio n. 1
0
        public async Task <IActionResult> Register(UserForRegisterDto userForRegisterDto)
        {
            // validate request
            userForRegisterDto.Username = userForRegisterDto.Username.ToLower();

            if (await _authBL.UserExists(userForRegisterDto.Username))
            {
                return(BadRequest("Username already exists"));
            }

            var userToCreate = new User
            {
                Username = userForRegisterDto.Username
            };

            var createdUser = await _authBL.Register(userToCreate, userForRegisterDto.Password);

            return(StatusCode(201));
        }
Esempio n. 2
0
 async Task <bool> UserExist(string username)
 {
     return(!await _authBl.UserExists(username));
 }