Esempio n. 1
0
        public PageModel(List <ApiControllerInformation> apiInformation, string apiId, string controllerName = "", string methodName = "", string attributeId = "")
        {
            ApiId         = apiId;
            ApiInfo       = apiInformation;
            CurrentMethod = new MethodInformation();

            if (!String.IsNullOrEmpty(controllerName))
            {
                CurrentApi = ApiInfo.Where(x => x.ControllerName == controllerName).FirstOrDefault();

                if (!String.IsNullOrEmpty(methodName))
                {
                    CurrentMethod = CurrentApi.Methods.Where(x => x.Name == methodName && x.Attributes.Contains(attributeId)).FirstOrDefault();
                }
                else
                {
                    CurrentMethod = new MethodInformation {
                        Name = "METHOD NOT FOUND"
                    };
                }
            }
            else
            {
                CurrentApi = new ApiControllerInformation();
            }
        }
Esempio n. 2
0
        public static List <ApiControllerInformation> CreateApiDocumentation(List <Type> types, Type controllerParentType)
        {
            var controllerInfo = new List <ApiControllerInformation>();

            foreach (var t in types)
            {
                if (t.IsSubclassOf(controllerParentType))
                {
                    var tempInfo = new ApiControllerInformation()
                    {
                        ControllerName = t.Name
                    };

                    tempInfo.Methods = ProcessControllerMethods(t.UnderlyingSystemType);

                    controllerInfo.Add(tempInfo);
                }
            }

            return(controllerInfo);
        }