public async Task <ActionResult> Delete(string source, int id) { try { GetStorageAccount(); RuleManagement rm = new RuleManagement(connectionString); await rm.DeleteFunction(source, id); } catch (Exception) { return(BadRequest()); } return(NoContent()); }
public static async Task <IActionResult> DeleteFunction( [HttpTrigger(AuthorizationLevel.Function, "delete", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("DeleteRuleFunction: 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"); RuleManagement rules = new RuleManagement(storageAccount); await rules.DeleteFunction(source, id); } catch (Exception ex) { log.LogError($"DeleteRuleFunction: Error deleting functions: {ex}"); return(new BadRequestObjectResult($"Error deleting function: {ex}")); } return(new OkObjectResult("OK")); }