public bool AddBackend(BasicBackendInformation newBackend)
 {
     if (!AllRegisteredBackends.ContainsKey(newBackend.IpAddress + ":" + newBackend.Port))
     {
         /* Entry does not exist yet */
         return(AllRegisteredBackends.TryAdd(newBackend.IpAddress + ":" + newBackend.Port, new ExtendedBackendInformation(newBackend)));
     }
     else
     {
         /* Entry already exists */
         AllRegisteredBackends[newBackend.IpAddress + ":" + newBackend.Port].Ping();
         return(true);
     }
 }
 public JsonResult PostSimpleDreamerBackends([FromBody] BasicBackendInformation body)
 {
     try
     {
         if (true == Program._SimpleDreamerBackendRegistryClass.AddBackend(body))
         {
             return(new JsonResult(JsonDefaultResponses.SimpleSuccess));
         }
         else
         {
             throw new Exception("Could not add backend");
         }
     }
     catch
     {
         return(new JsonResult(JsonDefaultResponses.SimpleFailed));
     }
 }
 public ExtendedBackendInformation(BasicBackendInformation basic)
 {
     Basic     = basic;
     PingStats = new PingStatsClass();
 }