Exemplo n.º 1
0
        public static async Task <IActionResult> IndexItem(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("GetIndexItem: Starting");
            string responseMessage = "";

            try
            {
                string name = req.Query["name"];
                if (string.IsNullOrEmpty(name))
                {
                    log.LogError("GetIndexItem: error, source name is missing");
                    return(new BadRequestObjectResult("Error missing source name"));
                }
                int             id             = Common.Helpers.Common.GetIntFromWebQuery(req, "id");
                string          storageAccount = Common.Helpers.Common.GetStorageKey(req);
                IndexManagement im             = new IndexManagement(storageAccount);
                responseMessage = await im.GetIndexItem(name, id);
            }
            catch (Exception ex)
            {
                log.LogError($"GetIndexItem: {ex}");
                return(new BadRequestObjectResult($"Error getting index item: {ex}"));
            }

            log.LogInformation("GetIndexItem: Complete");
            return(new OkObjectResult(responseMessage));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <string> > GetChildren(string source, int id)
        {
            string          storageAccount = Common.Helpers.Common.GetStorageKey(Request);
            IndexManagement im             = new IndexManagement(storageAccount);
            string          result         = await im.GetIndexItem(source, id);

            return(result);
        }