public string Control(Method method, Dictionary <string, string> param) { var tag = "control"; if (method == Method.Put) { if (param.ContainsKey("init")) //コントロールの初期化 { _webApi.ControlInit(); return(JsonConvert.SerializeObject(new Error(200, "init success", tag))); } if (param.ContainsKey("service")) //サーバの起動停止 { var service = param["service"]; switch (service) { case "start": _webApi.ServiceSmtp = true; return(JsonConvert.SerializeObject(new Error(200, "start service", tag))); case "stop": _webApi.ServiceSmtp = false; return(JsonConvert.SerializeObject(new Error(200, "stop service", tag))); default: return(JsonConvert.SerializeObject(new Error(504, "service = [start,stop]", tag))); } } return(JsonConvert.SerializeObject(new Error(503, "unknown parameter", tag))); } return(JsonConvert.SerializeObject(new Error(502, "unknown method", tag))); }