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)); }
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); }
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")); }
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()); }
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")); }
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")); }