Ejemplo n.º 1
0
        public static async Task <ThongKe> ThongKeAsync(HttpClient client)
        {
            string url = baseAddress + "api/thongke/" + user.id.ToString();
            HttpResponseMessage response = await client.GetAsync(url);

            if (response.IsSuccessStatusCode)
            {
                thongke = await response.Content.ReadAsAsync <ThongKe>();
            }
            return(thongke);
        }
Ejemplo n.º 2
0
        public static async Task ThongKe()
        {
            var client = new HttpClient();

            SetupClientDefaults(client);
            client.BaseAddress = new Uri(baseAddress);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            try
            {
                thongke = await ThongKeAsync(client);
            }
            catch (Exception e)
            {
            }
            finally
            {
            }
        }