Ejemplo n.º 1
0
        public static EditServiceJson CreateFrom(PrimetonDescriptorViewModel model, JsonTemplateNames partName)
        {
            var serviceJson = new EditServiceJson
            {
                ServiceDescriptor = JsonConvert.SerializeObject(model),
                CurrentPath       = "",
                CurrentName       = partName
            };

            switch (partName)
            {
            case JsonTemplateNames.PrimetonParameter:
                serviceJson.CurrentJson = JsonConvert.SerializeObject(model.InputBody);
                break;

            case JsonTemplateNames.PrimetonReturn:
                serviceJson.CurrentJson = JsonConvert.SerializeObject(model.ReturnBody);
                break;

            default:
                throw new Exception("传入了非普元系统Web服务类型的部位参数" + partName.ToString());
            }

            return(serviceJson);
        }
Ejemplo n.º 2
0
        public static EditServiceJson CreateFrom(SimpleRestfulDescriptorViewModel model, JsonTemplateNames partName)
        {
            var serviceJson = new EditServiceJson
            {
                ServiceDescriptor = JsonConvert.SerializeObject(model),
                CurrentPath       = "",
                CurrentName       = partName
            };

            switch (partName)
            {
            case JsonTemplateNames.RESTParameter:
                serviceJson.CurrentJson = JsonConvert.SerializeObject(model.JsonBodyTemplate);
                break;

            case JsonTemplateNames.RESTReturnValue:
                serviceJson.CurrentJson = JsonConvert.SerializeObject(model.ReturnJsonTemplate);
                break;

            default:
                throw new Exception("传入了非RESTful服务类型的部位参数" + partName.ToString());
            }

            return(serviceJson);
        }