Esempio n. 1
0
        private TimeRuleDto NextDayTimeRule(TimeRuleDto currentDay, int step = 1)
        {
            var nextWeekDay = currentDay.Weekday + step;

            if (nextWeekDay >= 7)
            {
                nextWeekDay = 0;
            }

            var nextDay = TimeRules.FirstOrDefault(p => p.Weekday == nextWeekDay);

            if (nextDay != null)
            {
                return(nextDay);
            }
            return(NextDayTimeRule(currentDay, step + 1));
        }