public async Task <ActionResult <DeleteResult> > Delete([FromBody] DeleteRequest request) { if (!await _authManager.HasSitePermissionsAsync(request.SiteId, GatherManager.PermissionsList)) { return(Unauthorized()); } await _ruleRepository.DeleteAsync(request.RuleId); var rules = await _ruleRepository.GetRulesAsync(request.SiteId); foreach (var rule in rules) { var gatherUrlList = GatherUtils.GetGatherUrlList(rule); if (gatherUrlList != null && gatherUrlList.Count > 0) { var url = gatherUrlList[0]; rule.Set("gatherUrl", url); } } return(new DeleteResult { Rules = rules }); }
public async Task <ActionResult <GetResult> > Get([FromQuery] GetRequest request) { if (!await _authManager.HasSitePermissionsAsync(request.SiteId, GatherManager.PermissionsList)) { return(Unauthorized()); } var rule = await _ruleRepository.GetAsync(request.RuleId); var gatherUrls = GatherUtils.GetGatherUrlList(rule); return(new GetResult { Rule = rule, GatherUrls = gatherUrls }); }