public async Task <IEnumerable <NotificationItem> > CountDataAsync(string url) { var list = new List <NotificationItem>(); using (var client = new HttpClient()) { try { var api = await client.GetStringAsync(url); var json = JArray.Parse(api); Queue = json; foreach (var value in json) { Console.WriteLine(api); var result = JObject.Parse(value.ToString()); var model = new NotificationItem() { Jumlah = result["Jumlah"].ToString() as string }; list.Add(model); } } catch { } } return(list); }
public async Task <IEnumerable <NotificationItem> > LoadDataAsync(string url) { var list = new List <NotificationItem>(); using (var client = new HttpClient()) { try { var api = await client.GetStringAsync(url); var json = JArray.Parse(api); Queue = json; foreach (var value in json) { var result = JObject.Parse(value.ToString()); var model = new NotificationItem() { Nama = result["first_name"].ToString() as string, Company = result["company"].ToString() as string }; list.Add(model); } } catch { } } return(list); }
public bool SenderData(NotificationItem model, HttpVerbs verbs) { var result = false; var json = JsonConvert.SerializeObject(model); var task = Task.Run(async() => await DataSenderAsync(json, verbs)); if (task.Result) { result = true; } return(result); }
public async Task <IEnumerable <NotificationItem> > CountData(string url) { var list = new List <NotificationItem>(); var task = await LoadDataAsync(url); foreach (var value in Queue) { var result = JObject.Parse(value.ToString()); var model = new NotificationItem() { Jumlah = result["Jumlah"].ToString() as string }; list.Add(model); } return(list); }
public async Task <IEnumerable <NotificationItem> > LoadData(string url) { var list = new List <NotificationItem>(); var task = await LoadDataAsync(url); foreach (var value in Queue) { var result = JObject.Parse(value.ToString()); var model = new NotificationItem() { Nama = result["first_name"].ToString() as string, Company = result["company"].ToString() as string }; list.Add(model); } return(list); }