Пример #1
0
 public HttpResponseMessage Get([FromUri] string command, string profile)
 {
     if (command.Equals("Disconnect"))
     {
         try {
             DIConnection.Me.Dispose();
             return(Request.CreateResponse(command + " Done"));
         } catch (Exception e) {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message + " : " + e.StackTrace));
         }
     }
     else if (command.Equals("GetConfig"))
     {
         try {
             var cp = ConnectionParams.GetConnectionProfile(profile);                    //"SQLBrokerDefault"
             return(Request.CreateResponse <NoPwdConnectionParams>(HttpStatusCode.OK, new NoPwdConnectionParams(cp)));
         } catch (Exception e) {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message + " : " + e.StackTrace));
         }
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, command + " Unknown"));
     }
 }