Пример #1
0
        private IEnumerable <IHtmlTemplate> TryGenerateMethodTemplateInstances(out string explanation, IList <ControllerMethod> controllerMethods)
        {
            List <IHtmlTemplate> htmlTemplates = new List <IHtmlTemplate>();
            var methodHeader = new NoDataHtml(_methodHeader);

            if (!methodHeader.IsValid(out explanation))
            {
                return(null);
            }
            if (controllerMethods == null)
            {
                return(htmlTemplates);
            }
            foreach (var method in controllerMethods)
            {
                htmlTemplates.Add(methodHeader);
                var methods = new Methods(_methods, new [] { method });
                if (!methods.IsValid(out explanation))
                {
                    return(null);
                }
                htmlTemplates.Add(methods);
                var argumentElements = TryGenerateArgumenTemplateInstance(out explanation, method.Arguments);
                if (argumentElements == null)
                {
                    return(null);
                }

                htmlTemplates.AddRange(argumentElements);
            }
            explanation = null;
            return(htmlTemplates);
        }
Пример #2
0
        private IEnumerable <IHtmlTemplate> TryGenerateArgumenTemplateInstance(out string explanation, IList <Argument> arguments)
        {
            List <IHtmlTemplate> htmlTemplates = new List <IHtmlTemplate>();
            var argumentHeader = new NoDataHtml(_argumentHeader);

            if (!argumentHeader.IsValid(out explanation))
            {
                return(null);
            }
            var argumentHtmlInstance = new Arguments(_arguments, arguments);

            if (!argumentHtmlInstance.IsValid(out explanation))
            {
                return(null);
            }
            htmlTemplates.Add(argumentHeader);
            htmlTemplates.Add(argumentHtmlInstance);
            htmlTemplates.Add(new NoDataHtml(_finish));
            return(htmlTemplates);
        }