public async Task <ActionResult <IEnumerable <Stock> > > ConvertStocks1() { StockDataModel1 stockData = new StockDataModel1(); var request = new HttpRequestMessage(HttpMethod.Get, "https://rest.zse.hr/web/Bvt9fe2peQ7pwpyYqODM/price-list/XZAG/2021-07-27/json"); var client = _clientFactory.CreateClient(); HttpResponseMessage response = await client.SendAsync(request); if (response.IsSuccessStatusCode) { stockData = await response.Content.ReadFromJsonAsync <StockDataModel1>(); var listam = await _stockService.ListAllStocksAsync(); foreach (var item in listam) { foreach (var subitem in stockData.securities) { await _securityService .GetMeStocks1(subitem.symbol, Convert.ToDecimal(subitem.close_price)); } } } return(Ok(stockData)); }
public async Task <ActionResult <IEnumerable> > GetSecurities() { StockDataModel1 stockData = new StockDataModel1(); var request = new HttpRequestMessage(HttpMethod.Get, "https://rest.zse.hr/web/Bvt9fe2peQ7pwpyYqODM/price-list/XZAG/2021-06-14/json"); var client = _clientFactory.CreateClient(); HttpResponseMessage response = await client.SendAsync(request); if (response.IsSuccessStatusCode) { stockData = await response.Content.ReadFromJsonAsync <StockDataModel1>(); } return(Ok(stockData)); }