Exemplo n.º 1
0
        public static async Task LoadRegions()
        {
            var url      = String.Format("{0}/api/v1/refs/regions", Setting.ApiUrl);
            var response = await Server.GetEntity(url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var content = response.Content;
                var obj     = SoatoDataResponse.Deserialize(content);
                Items = obj.Data.ToList();
            }
            else
            {
                Items = new List <Soato>();
            }
        }
Exemplo n.º 2
0
        public static SoatoDataResponse Deserialize(string json)
        {
            SoatoDataResponse rs;

            try
            {
                var jss = new JsonSerializerSettings
                {
                    DateTimeZoneHandling = DateTimeZoneHandling.Local,
                    DateFormatString     = "yyyyMMdd"
                };
                rs = JsonConvert.DeserializeObject <SoatoDataResponse>(json, jss);
            }
            catch
            {
                rs = new SoatoDataResponse();
            }
            return(rs);
        }