public static List <HeroCard> GetResults(string url) { List <HeroCard> CardList = new List <HeroCard>(); RSS rss = new RSS(url); SyndicationFeed Feed = rss.Get(); if (Feed != null) { foreach (var item in Feed.Items.Take(5)) { var heroCard = new HeroCard { Title = item.Title.Text, Subtitle = item.Categories.FirstOrDefault().Name, Text = item.Summary.Text, Buttons = new List <CardAction> { new CardAction(ActionTypes.OpenUrl, "Link", value: item.Links.FirstOrDefault().Uri.ToString()) } }; CardList.Add(heroCard); } } return(CardList); }
public static List <HeroCard> GetResults(string url, string cat, string loc) { List <HeroCard> CardList = new List <HeroCard>(); RSS rss = new RSS(url); SyndicationFeed Feed = rss.Get(); if (Feed != null) { int cnt = 0; foreach (var item in Feed.Items) { string s1 = item.Summary.Text.ToString(); bool boolean = s1.StartsWith("Category: " + cat + " <br><br>Location: " + loc); if (boolean == true) { cnt = cnt + 1; var heroCard = new HeroCard { Title = item.Title.Text, Buttons = new List <CardAction> { new CardAction(ActionTypes.OpenUrl, "Link", value: item.Links.FirstOrDefault().Uri.ToString()) } }; CardList.Add(heroCard); } } if (cnt == 0) { var heroCard = new HeroCard { Title = "No jobs found for your selection" }; CardList.Add(heroCard); } } return(CardList); }