private void SubscriberSubscribeToTopicRequest() { Post("/subscribeToTopic", param => { var subscriberIDString = GetQueryValueFromKey("id"); var topicName = GetQueryValueFromKey("topicName"); int subscriberID; if (int.TryParse(subscriberIDString, out subscriberID)) { if (subscriberID >= 0 && topicName.Length > 0 && Broker.AddSubscriberToTopic(subscriberID, topicName)) { return(GetSuccessJSONMessage($"Subscriber {subscriberID} successfully added to topic {topicName}")); } } return(GetFailureJSONMessage($"Subscriber {subscriberIDString} was not added to the topic {topicName}. (Perhaps an invalid ID?)")); }); }