예제 #1
0
        public static async Task <IActionResult> AttributeInfo(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            string jsonResult = "OK";

            try
            {
                string            storageAccount = Common.Helpers.Common.GetStorageKey(req);
                string            source         = Common.Helpers.Common.GetQueryString(req, "name");
                string            dataType       = Common.Helpers.Common.GetQueryString(req, "datatype");
                Sources           ss             = new Sources(storageAccount);
                ConnectParameters connector      = await ss.GetSourceParameters(source);

                AttributeInfo        info = new AttributeInfo();
                ReportEditManagement rm   = new ReportEditManagement(storageAccount);
                jsonResult = await rm.GetAttributeInfo(source, dataType);
            }
            catch (Exception ex)
            {
                log.LogError($"ReportAttributeInfo: Error getting attribute info: {ex}");
                return(new BadRequestObjectResult($"Error getting attribute info: {ex}"));
            }
            return(new OkObjectResult(jsonResult));
        }
예제 #2
0
        public async Task <ActionResult <string> > GetAttributeInfo(string source, string datatype)
        {
            GetStorageAccount();
            AttributeInfo        info = new AttributeInfo();
            ReportEditManagement rm   = new ReportEditManagement(connectionString);
            string responseMessage    = await rm.GetAttributeInfo(source, datatype);

            return(responseMessage);
        }
예제 #3
0
 public async Task <ActionResult <string> > UpdateIndex(string source, ReportData reportData)
 {
     try
     {
         GetStorageAccount();
         ReportEditManagement rm = new ReportEditManagement(connectionString);
         await rm.InsertEdits(reportData, source);
     }
     catch (Exception ex)
     {
         return(BadRequest());
     }
     return(Ok($"OK"));
 }
예제 #4
0
        public async Task <ActionResult> Delete(string source, int id, string rulekey)
        {
            try
            {
                GetStorageAccount();
                ReportEditManagement rm = new ReportEditManagement(connectionString);
                await rm.DeleteEdits(source, id);
            }
            catch (Exception)
            {
                return(BadRequest());
            }

            return(NoContent());
        }
예제 #5
0
 public static async Task <IActionResult> DeleteIndex(
     [HttpTrigger(AuthorizationLevel.Function, "delete", Route = null)] HttpRequest req,
     ILogger log)
 {
     log.LogInformation("DeleteReportData: Starting");
     try
     {
         string storageAccount   = Common.Helpers.Common.GetStorageKey(req);
         string source           = Common.Helpers.Common.GetQueryString(req, "name");
         int    id               = Common.Helpers.Common.GetIntFromWebQuery(req, "id");
         ReportEditManagement rm = new ReportEditManagement(storageAccount);
         await rm.DeleteEdits(source, id);
     }
     catch (Exception ex)
     {
         log.LogError($"DeleteReportData: Error deleting report edits: {ex}");
         return(new BadRequestObjectResult($"Error deleting report edits: {ex}"));
     }
     log.LogInformation("DeleteReportData: Completed");
     return(new OkObjectResult("OK"));
 }
예제 #6
0
 public static async Task <IActionResult> UpdateIndex(
     [HttpTrigger(AuthorizationLevel.Function, "put", Route = null)] HttpRequest req,
     ILogger log)
 {
     log.LogInformation("UpdateReportData: Starting");
     try
     {
         string               storageAccount = Common.Helpers.Common.GetStorageKey(req);
         string               source         = Common.Helpers.Common.GetQueryString(req, "name");
         string               requestBody    = await new StreamReader(req.Body).ReadToEndAsync();
         ReportData           reportData     = JsonConvert.DeserializeObject <ReportData>(requestBody);
         ReportEditManagement rm             = new ReportEditManagement(storageAccount);
         await rm.InsertEdits(reportData, source);
     }
     catch (Exception ex)
     {
         log.LogError($"UpdateReportData: Error updating report edits: {ex}");
         return(new BadRequestObjectResult($"Error updating report edits: {ex}"));
     }
     log.LogInformation("UpdateReportData: Completed");
     return(new OkObjectResult("OK"));
 }