public async Task <IActionResult> SearchTrade([FromQuery] TradeSearchModel tradeSearch) { var trades = await tradesApi.SearchTrades(tradeSearch); var model = new DashboardViewModel(); model.Trades = trades; return(PartialView("_TradeListPartial", model)); }
public async Task <List <TradeDTO> > SearchTrades(TradeSearchModel tradeSearch) { // return the last 10 trades for the client/user // search for trade using the tradesearch properties using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(apiBaseUrl); HttpResponseMessage msg = await client.GetAsync($"trade/query?id={tradeSearch.UserId}&startDate={tradeSearch.FromDateTime}&endDate={tradeSearch.ToDateTime}&exchange={tradeSearch.Exchange}¤cyCode={tradeSearch.currencyCode}"); msg.EnsureSuccessStatusCode(); var responseBody = await msg.Content.ReadAsAsync <List <TradeDTO> >(); return(responseBody); } }