public async Task <HttpResponseMessage> FreeTheSpace(int id, string locationCode) { var request = new GroundControlPermissionRequest("Air Facility", id.ToString(), locationCode, "Idle"); var json = JsonConvert.SerializeObject(request); var content = new StringContent(json, Encoding.UTF8, "application/json"); const string url = "/updateTFStatus"; HttpResponseMessage responseMessage = null; try { responseMessage = await Client.PostAsync(url, content); } catch (Exception ex) { if (responseMessage == null) { responseMessage = new HttpResponseMessage(); } responseMessage.StatusCode = HttpStatusCode.InternalServerError; responseMessage.ReasonPhrase = $"RestHttpClient.FreeTheSpace failed: {ex}"; } return(responseMessage); }
public async Task <HttpResponseMessage> PermissionOnFlight(string from, string to, int id) { var request = new GroundControlPermissionRequest(from, to, "Air Facility", id.ToString()); var json = JsonConvert.SerializeObject(request); var content = new StringContent(json, Encoding.UTF8, "application/json"); const string url = "/askForPermission"; HttpResponseMessage responseMessage = null; try { responseMessage = await Client.PostAsync(url, content); } catch (Exception ex) { if (responseMessage == null) { responseMessage = new HttpResponseMessage(); } responseMessage.StatusCode = HttpStatusCode.InternalServerError; responseMessage.ReasonPhrase = $"RestHttpClient.PermissionOnFlight failed: {ex}"; } return(responseMessage); }