public void Update(string id, string text) { var repository = new LocalPolicyRuleProjectRepository(this.GetPoliciesStorePath()); var project = repository.Get(id); if (project == null) { throw new InvalidOperationException("Rule not found"); } var rule = this.Parse(text); var ruleProject = new PolicyRuleProject(project.Id, rule); this.StorePolicy(ruleProject); }
public string GetPolicyViewModel(string id) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("id"); } this.EnsurePoliciesFolder(); var repository = new LocalPolicyRuleProjectRepository(this.GetPoliciesStorePath()); var project = repository.Get(id); if (project == null) { throw new InvalidOperationException("Rule not found"); } return(project.RuleJson); }