public async Task <IActionResult> LoginUserNameAsync([FromBody] DTO.UserNameLoginInput userNameLogin)
        {
            var token = await AuthManager.LoginUserAsync(userNameLogin);

            return(Ok(new DTO.SuccessResponse <DTO.TokenOutput>()
            {
                Success = true,
                Content = token
            }));
        }
        public async Task <DTO.TokenOutput> LoginUserAsync(DTO.UserNameLoginInput userNameLogin)
        {
            var existingUser = await UserManager.FindByNameAsync(userNameLogin.UserName);

            if (existingUser == null)
            {
                throw new BadRequestException("An incorrect password or username was used.");
            }

            var validPassword =
                await UserManager.CheckPasswordAsync(existingUser, userNameLogin.Password);

            if (!validPassword)
            {
                throw new BadRequestException("An incorrect password or username was used.");
            }

            return(await GenerateAuthenticationTokenAsync(existingUser));
        }