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; }
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; }