Inheritance: RuleModelBase
Beispiel #1
0
        public static RuleModelBase FromRule(Rule rule)
        {
            if (rule is AlwaysRule)
            {
                return(AlwaysRuleModel.FromRule(rule as AlwaysRule));
            }
            if (rule is IfElseRule)
            {
                return(IfElseRuleModel.FromRule(rule as IfElseRule));
            }
            if (rule is SwitchCaseRule)
            {
                return(SwitchCaseRuleModel.FromRule(rule as SwitchCaseRule));
            }

            throw new NotSupportedException();
        }
Beispiel #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;
        }
Beispiel #3
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);
        }