public async Task <ResponsePackage> GetGTASearchData(string baseUri, string reqUri, SearchTransferModel message) { ResponsePackage responsePackage = new ResponsePackage(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUri); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string requestObject = JsonConvert.SerializeObject(message); using (HttpResponseMessage Res = await client.PostAsJsonAsync(reqUri, message)) { if (Res.IsSuccessStatusCode) { var partnerResponse = Res.Content.ReadAsStringAsync().Result; responsePackage = JsonConvert.DeserializeObject <ResponsePackage>(partnerResponse); } return(responsePackage); } } }
public async Task <IHttpActionResult> SelectTransfer(SearchTransferModel model) { var result = await MediatR.SendAsync(model); return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, result))); }