Ejemplo n.º 1
0
		public async Task<Venue> LoadVenue(string venueId)
		{
			Yelp.YelpAPI yelp = new Yelp.YelpAPI ();

			string resultStr = await yelp.GetBusinessAsync (venueId);
			Yelp.Business result = resultStr.FromJson<Yelp.Business> ();

			if (result != null) {
				var newVenue = new Venue (result);
				_venueList [newVenue.id] = newVenue;
				return newVenue;
			}
			else
				return null;
		}
Ejemplo n.º 2
0
		public async Task<Venue> LoadVenue(string venueId)
		{
			Yelp.YelpAPI yelp = new Yelp.YelpAPI ();
			Yelp.Business result = null;

			try
			{
				string resultStr = await yelp.GetBusinessAsync (venueId);
				result = resultStr.FromJson<Yelp.Business> ();
			}
			catch (Exception exp)
			{
				Console.WriteLine("error fetching yelp business: " + exp.Message);
			}

			if (result == null) {
				// create placeholder
				result = Yelp.Business.CreateSample ();
			}

			// return venue from result
			var newVenue = new Venue (result);
			_venueList [newVenue.id] = newVenue;
			return newVenue;
		}