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; }
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; }