Beispiel #1
0
        public string GetResult(int number)
        {
            if (!IsValid(number))
            {
                throw new ArgumentOutOfRangeException("Number must be greater than 0");
            }

            string result = "";

            foreach (var rule in _ruleRepository.GetAll())
            {
                var resolver = _ruleTypeFactory.Create(rule.RuleType);
                result += resolver.GetWord(number, rule);
            }

            return(string.IsNullOrEmpty(result) ? number.ToString() : result);
        }
 public IHttpActionResult GetAll()
 {
     return(Ok(_repository.GetAll()));
 }