public async Task <ActionResult> GetPassword() { try { PasswordResponseModel result = await _passwordGenerator.CreatePasswordAsync(new PasswordRequestModel { Length = PasswordLength }); return(Ok(result)); } catch (Exception ex) { _logger.LogError($"Error while generating random password - {ex}", ex.Message); return(BadRequest("Please try again.")); } }