0

Can I using API restful to EvaluateRule without send ruleData, I want send objectVM in post API and loop in list of rules, without pass ruleData in API

        [HttpPost]
        public ActionResult EvaluateRule(Patient patient)
        {
          var list=StorageService.GetEvaluationRules();

          foreach (var item in list)
          {
                // I missing (string ruleData) to 
          }
        }
Sara
  • 1

1 Answers1

0

Yes, you can. The ruleDate param is the data passed by the editor. You use that data if you want to evaluate the rule currently displayed in the rule area of the editor.

But if you already have your rules and just want to evaluate them one by one against your source (the Patient instance in this case) then do this:

[HttpPost]
public ActionResult EvaluateRule(Patient patient)
{
   var list = YourRuleStorage.GetTheListOfYourRules();
   Type type = patient.GetType();

   foreach(string rule in list)
   {
      new Evaluator(type, rule).Evaluate(patient);
   }
}
Alex
  • 566
  • 1
  • 6
  • 14