Пример #1
0
        public string GetCallArgumentValue(WebApiHttpVerb verb)
        {
            var isFormBody = verb == WebApiHttpVerb.Post || verb == WebApiHttpVerb.Put;

            var callArgumentValueString = BodyParameters
                                          .Select(routePart =>
            {
                var typeScriptType = routePart.GetTypeScriptType()
                                     .TypeName;

                var valueFormat = $"{routePart.Name}";

                switch (typeScriptType)
                {
                case "string":
                    valueFormat = $"`\"${{{routePart.Name}}}\"`";
                    break;
                }

                return($"{routePart.Name} != null ? {valueFormat} : null");
            })
                                          .SingleOrDefault();

            return((!isFormBody || string.IsNullOrEmpty(callArgumentValueString))
                 ? "null, httpConfig"
                 : $"{callArgumentValueString}, httpConfig");
        }
Пример #2
0
        public string GetActionNameForVerb(WebApiHttpVerb verb)
        {
            var verbPostfix = Verbs.Count > 1
                ? verb == WebApiHttpVerb.Post ? "New" : "Existing"
                : string.Empty;

            return($"{Name}{verbPostfix}");
        }
        public string GetCallArgumentDefinition(WebApiHttpVerb verb)
        {
            var isFormBody = verb == WebApiHttpVerb.Post || verb == WebApiHttpVerb.Put;

            if (!isFormBody)
            {
                return(string.Empty);
            }

            return(BodyParameters
                   .Select(a => a.GetParameterString(withOptionals: false, interfaceName: true))
                   .SingleOrDefault());
        }
Пример #4
0
        public string GetCallArgumentDefinition(WebApiHttpVerb verb)
        {
            var isFormBody = verb == WebApiHttpVerb.Post || verb == WebApiHttpVerb.Put;

            if (!isFormBody)
            {
                return("httpConfig?: ng.IRequestShortcutConfig");
            }

            var bodyParam = BodyParameters
                            .Select(a => a.GetParameterString(withOptionals: false, interfaceName: true))
                            .SingleOrDefault();

            return(string.IsNullOrWhiteSpace(bodyParam)
                ? "httpConfig?: ng.IRequestShortcutConfig"
                : $"{bodyParam}, httpConfig?: ng.IRequestShortcutConfig");
        }