private async Task <IEnumerable <Rate> > GetRatesAsync(OpenQuery searchQuery) { var rates = new List <Rate>(); // Filling the institutions results manually just for demo purposes //list of institituions List <string> institutions = new List <string>(); institutions.Add("The Brothers Institution"); institutions.Add("The Vulchers Institution"); institutions.Add("The Kids Institution"); institutions.Add("The Monopoly Institution"); institutions.Add("The Crazy Institution"); for (int i = 0; i < 5; i++) { var random = new Random(i); Rate rate = new Rate() { Name = institutions[i], //Location = searchQuery.Destination, Rating = random.Next(1, 5), NumberOfReviews = random.Next(0, 5000), PriceStarting = random.Next(0, 100) / 100, Image = $"https://placeholdit.imgix.net/~text?txtsize=35&txt=Hotel+{i}&w=500&h=260" }; rates.Add(rate); } rates.Sort((h1, h2) => h1.PriceStarting.CompareTo(h2.PriceStarting)); return(rates); }
private static OpenQuery CreateOpenQueryFromResponse( string rootNode, XPathNavigator infoNav) { OpenQuery oq = null; XPathExpression infoPath = GetInfoQueryIdXPathExpression(infoNav, rootNode); infoNav = infoNav.SelectSingleNode(infoPath); string queryIdString = infoNav.SelectSingleNode("query-id").Value; Guid queryId = new Guid(queryIdString); oq = new OpenQuery(queryId); oq._appName = infoNav.SelectSingleNode("app-name").Value; oq._createDate = infoNav.SelectSingleNode("date-created").ValueAsDateTime; XPathNavigator nav = infoNav.SelectSingleNode("expires-date"); if (nav != null) oq._expiresDate = nav.ValueAsDateTime; nav = infoNav.SelectSingleNode("pin-required"); if (nav != null) oq._pinRequired = nav.ValueAsBoolean; nav = infoNav.SelectSingleNode("note"); if (nav != null) oq._note = nav.Value; return oq; }