public async Task <IHttpActionResult> BankCurrencyList() { List <Source1ListModel> bankCurrencyList = new List <Source1ListModel>(); var bankList = _scripts.BankNames(); foreach (var item in bankList) { Uri URL = new Uri("https://kur.doviz.com/" + item); List <Source1Model> currencyList = new List <Source1Model>(); string html = client.DownloadString(URL); HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); try { var tableRow = document.DocumentNode.Descendants("tr"); int count = 0; foreach (var node in tableRow) { var array = node.InnerText.Replace(" ", "").Trim().Split('\n'); if (count < 1) { count++; } else { Source1Model model = new Source1Model(); model.Name = _scripts.NameControl(array[0]); model.Buyin = array[3]; model.Sales = array[4]; model.UpdateTime = array[5]; count++; currencyList.Add(model); } } Source1ListModel ListModel = new Source1ListModel { BankName = item, CurrencyList = currencyList }; bankCurrencyList.Add(ListModel); } catch (Exception) { return(Ok("null")); } } ResultModel <Source1ListModel> model2 = new ResultModel <Source1ListModel> { _Title = "Curency Data", _DateTime = DateTime.Now.ToString(), _Result = bankCurrencyList, _Count = bankCurrencyList.Count }; return(Ok(model2)); }