public async void GetStories(string storyType) { IsLoading = true; StoryType = storyType; if (CheckCurrentListName(storyType) && storyType != "Next") { StoryItemApiName = storyType.ToLower() + "stories"; //OnPropertyChanged("StoryItemApiName"); NextItem = 0; Clear(); } GetStoriesResponse result = await EndPoint.GetStories(StoryItemApiName, Increment, NextItem); //result.ForEach(x => Add(x)); if (StoryType == storyType) { NextItem = result.NextItem; if (NextItem < 0) { GetStoriesCommand.RaiseCanExecuteChanged(); } foreach (var item in result.StoriesCollection) { Add(item); } } IsLoading = false; }
/// <summary> /// Assembles a GetStoriesResponse object from a list of stories /// </summary> /// <param name="stories"></param> /// <returns></returns> public static GetStoriesResponse Assemble(List <string> stories) { GetStoriesResponse getStoriesResponse = new GetStoriesResponse { Stories = new List <Story>() }; int storyId = 1; foreach (string story in stories) { getStoriesResponse.Stories.Add(StoryAssembler.Assemble(story, storyId)); storyId++; } return(getStoriesResponse); }