public bool Valid(HabitGoal goal)
        {
            if (!_goalValidator.Valid(goal))
            {
                return(false);
            }

            return(goal.Target > 0 && goal.Logs.All(log => log.Date >= goal.StartDate && log.Date <= goal.EndDate));
        }
示例#2
0
        public bool Valid(NumberGoal goal)
        {
            if (!_goalValidator.Valid(goal))
            {
                return(false);
            }

            if (goal.Target <= 0)
            {
                return(false);
            }

            if (goal.Logs.Any(log => log.Date < goal.StartDate || log.Date > goal.EndDate))
            {
                return(false);
            }

            return(!goal.Logs.Any(log => log.Amount <= 0));
        }
        public bool Valid(ListGoal goal)
        {
            if (!_goalValidator.Valid(goal))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(goal.ListName) || string.IsNullOrWhiteSpace(goal.ListName))
            {
                return(false);
            }

            if (goal.Target <= 0)
            {
                return(false);
            }

            return(!goal.Items.Any(item => string.IsNullOrEmpty(item.Name) || string.IsNullOrWhiteSpace(item.Name)));
        }