public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getlibraryuser")] HttpRequest req, ILogger log)
        {
            var result = _tokenProvider.ValidateToken(req);

            if (result.Status == AccessTokenStatus.Valid)
            {
                log.LogInformation($"Request received for {result.Principal.Identity.Name}.");
            }
            else
            {
                return(new UnauthorizedResult());
            }

            string Id = req.Query["Id"];

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            Id = Id ?? data?.name;

            if (string.IsNullOrEmpty(Id))
            {
                return(new BadRequestObjectResult("Please pass id on the query string or in the request body"));
            }

            var libraryUser = _libraryUserWebApiManager.GetLibraryUserByLibraryUserCode(Id);

            if (libraryUser == null)
            {
                return(new BadRequestObjectResult("User not found"));
            }

            return((ActionResult) new OkObjectResult(libraryUser));
        }
        public IActionResult Get(string id)
        {
            var libraryuser = _libraryUserWebApiManager.GetLibraryUserByLibraryUserCode(id);

            if (libraryuser == null)
            {
                ModelState.AddModelError(string.Empty, "Unknown user code");
                return(BadRequest(ModelState));
            }

            return(Ok(libraryuser));
        }