Ejemplo n.º 1
0
        private string Method_Title(DocumentorContext context, params object[] parameters)
        {
            MethodInfo           restMethod = parameters[0] as MethodInfo;
            MethodTitleAttribute attr       = restMethod.GetRadishAttribute <MethodTitleAttribute>();

            return(attr != null ? attr.Title : "");
        }
Ejemplo n.º 2
0
        private string Page_JsonMethodsList(DocumentorContext context, params object[] parameters)
        {
            StringBuilder sbMethods = new StringBuilder();

            foreach (MethodInfo methodInfo in context.RestMethods)
            {
                string title  = "";
                string method = "";
                string route  = "";
                string id     = "";

                MethodAttribute attrMethod = methodInfo.GetRadishAttribute <MethodAttribute>();
                if (attrMethod != null)
                {
                    id     = attrMethod.Id;
                    route  = attrMethod.Route;
                    method = attrMethod.MethodType;
                }

                MethodTitleAttribute attrTitle = methodInfo.GetRadishAttribute <MethodTitleAttribute>();
                if (attrTitle != null)
                {
                    title = attrTitle.Title;
                }

                sbMethods.Append(
                    String.Format("{{\"title\": \"{0}\", \"method\" : \"{1}\", \"route\": \"{2}\", \"id\" : \"{3}\"}},\n",
                                  title, method, route, id));
            }

            return(sbMethods.ToString());
        }