public string AddUpdateRule(JObject ruleDefinition) { var o = ruleDefinition.ToObject <RuleDefinition>(); if (NullString(o.entityName) || NullString(o.ruleName) || NullString(o.ruleCondition) || NullString(o.ruleGroup)) { return("false"); } Rule rule = new Rule() { EntityName = o.entityName, Priority = o.priority, RuleName = o.ruleName, RuleCondition = o.ruleCondition, RuleGroup = o.ruleGroup }; rule.RuleExecution = new List <RuleExecution>(); foreach (var ruleExecution in o.ruleExecution) { if (NullString(ruleExecution.propertyName) || NullString(ruleExecution.execution)) { return("false"); } rule.RuleExecution.Add(new RuleExecution() { PropertyName = ruleExecution.propertyName, Execution = ruleExecution.execution, Order = ruleExecution.order }); } RulesManager.AddorUpdateRule(rule); return("true"); }