public virtual async Task <AfricoderLinksModel.Datum[]> GetNextLinkPosts(int currentIndex, int ID) { Endpoint = Endpoint + currentIndex.ToString(); africoderLinksFeed = new AfricoderLinksFeed(); obtainer = new JsonObtainer(Endpoint, "Blog Pagination Agent"); string jsonresult = await obtainer.GetJsonStringAsync(); africoderLinksFeed = JsonConvert.DeserializeObject <AfricoderLinksFeed>(jsonresult); foreach (var dat in africoderLinksFeed.data) { dat.LoggedInID = ID; } return(africoderLinksFeed.data); }
public virtual async Task <List <ForumModel.Datum> > GetNextForumPosts(int currentIndex, int ID) { //Endpoint = Endpoint + currentIndex.ToString(); africoderLinksFeed = new AfricoderLinksFeed(); obtainer = new JsonObtainer(Endpoint, "Blog Pagination Agent"); string jsonresult = await obtainer.GetJsonStringAsync(); individualForum = JsonConvert.DeserializeObject <IndividualForum>(jsonresult); foreach (var dat in individualForum.data) { dat.LoggedInID = ID; } return(individualForum.data); }
public virtual async Task <Datum[]> GetNextStatusPosts(int currentIndex, int ID) { string jsonResult = string.Empty; //Paginate the status as necessary. Endpoint = Endpoint + currentIndex.ToString(); //Create new obtainer obtainer = new JsonObtainer(Endpoint, "Status Pagination Agent"); jsonResult = await obtainer.GetJsonStringAsync(); africoderStatusFeed = JsonConvert.DeserializeObject <AfricoderStatusFeed>(jsonResult); foreach (var dat in africoderStatusFeed.data) { dat.LoggedInID = ID; } return(africoderStatusFeed.data); }
public async Task <Datum[]> GetStuffDone(string endpoint, int CurrentPageNumber, int ID) { AfricoderStatusFeed africoderStatusFeed; string ed = endpoint + CurrentPageNumber.ToString(); using (JsonObtainer jsonObtainer = new JsonObtainer(ed, "BOLKAY_AGENT")) { string result = await jsonObtainer.GetJsonStringAsync(); africoderStatusFeed = JsonConvert.DeserializeObject <AfricoderStatusFeed>(result); foreach (var bd in africoderStatusFeed.data) { bd.LoggedInID = ID; //reformat the html adorned body string b = Regex.Replace(bd.body, @"<[^>]*>", ""); bd.body = b; //Find a way to change the date to reflect the current reality. DateTime dateTime = DateTime.Parse(bd.created.date); DateTime currentDate = DateTime.Now; TimeSpan timeSpan = currentDate - dateTime; if (timeSpan.Days <= 1) { bd.created.date = timeSpan.Hours.ToString() + " hours ago"; }//Set the date else if (timeSpan.Days > 1) { bd.created.date = timeSpan.Days.ToString() + " days ago"; } } } return(africoderStatusFeed.data); }