示例#1
0
        public override Rule ToRule(EventSlot slot)
        {
            var rule = new IfElseRule();
            rule.Conditions = Conditions.ToList();

            foreach (var thenRuleModel in Then)
            {
                rule.Then.Add(thenRuleModel.ToRule(slot));
            }

            foreach (var elseRuleModel in Else)
            {
                rule.Else.Add(elseRuleModel.ToRule(slot));
            }

            return rule;
        }
示例#2
0
        public static IfElseRuleModel FromRule(IfElseRule rule)
        {
            var model = new IfElseRuleModel();

            model.Conditions = rule.Conditions.ToList();

            foreach (var thenRule in rule.Then)
            {
                model.Then.Add(FromRule(thenRule));
            }

            foreach (var elseRule in rule.Else)
            {
                model.Else.Add(FromRule(elseRule));
            }

            return model;
        }