public async Task <oBin> GetBinLocation(string binCode) { try { if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed) { GlobalInstance.Instance.SqlObject.Open(); } if (GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Broken || GlobalInstance.Instance.SqlObject.State == System.Data.ConnectionState.Closed) { errMsg = "Unable to connect to server."; var resp = new HttpResponseMessage(HttpStatusCode.Conflict); resp.Content = new StringContent(errMsg); resp.ReasonPhrase = "No Server Connection"; throw new HttpResponseException(resp); } return(await repo.GetBinLocation(binCode)); } catch (HttpResponseException ex) { throw new HttpResponseException(ex.Response); } }