public async Task <IList <oBusinessPartner> > GetBusinessPartnersByGroupCode(int groupCode) { 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.GetByGroupCode(groupCode)); } catch (HttpResponseException ex) { throw new HttpResponseException(HttpStatusCode.BadRequest); } }