コード例 #1
0
ファイル: BootServicesModule.cs プロジェクト: pk8est/Antd
        public BootServicesModule()
        {
            Get["/boot/services"] = x => {
                var hostcfg = new HostConfiguration();
                var model   = new PageBootServicesModel {
                    Services = string.Join(Environment.NewLine, hostcfg.GetHostServices())
                };
                return(JsonConvert.SerializeObject(model));
            };

            Post["/boot/services"] = x => {
                string servicesText = Request.Form.Config;
                var    services     = servicesText.SplitToList(Environment.NewLine).Where(_ => !string.IsNullOrEmpty(_));
                var    hostcfg      = new HostConfiguration();
                hostcfg.SetHostServices(services);
                hostcfg.ApplyHostServices();
                return(HttpStatusCode.OK);
            };
        }