Create the evaluator class
After you prepare the project, you implement the evaluator class. The evaluator class is a class that is used to determine whether the current user is a match for the specified criterion.
The evaluator class must implement the ICriterionEvaluator interface. To create the evaluator class:
- In Visual Studio, open the context menu of the DayOfWeekPersonalization project and click Add » Class.
- Name the class file DayOfWeekEvaluator.cs and click Add.
- Make the DayOfWeekEvaluator class implement the ICriterionEvaluator interface.
- Define the CurrentDayOfWeek property.
You get the current day of the week represented as a System.DayOfWeek enum, convert it to an integer number and then return the value.
- Implement the ICriterionEvaluator interface.
The value of the current day of the week is compared with the value that you configure as a criterion. If the values match, the personalized version of the page is displayed. Otherwise, the default page is displayed.
Use the following code sample: