Exemplo n.º 1
0
        public IEnumerable <houseEntity> GetHouseList(string csrfToken)
        {
            var urls = new UrlGenerator().GetHouseListApiUrl();

            Helper.WriteMultipleLineLig("Request urls", urls.ToList(), log);
            IEnumerable <houseEntity> houseList = new List <houseEntity>();

            foreach (var url in urls)
            {
                try
                {
                    var response      = Get591Response(url, Method.POST, csrfToken).Content;
                    var houseResponse = JsonConvert.DeserializeObject <ResponseHouseEntity>(response);
                    var entity        = Convert591DataToEntity(houseResponse.data.data);
                    houseList = houseList.Concat(entity);
                }
                catch (Exception ex)
                {
                    log.Error("GetHouseList error. msg:" + ex.Message);
                }
            }

            return(houseList);
        }