//
        // GET: /Business/

        public ActionResult Details(string id)
        {
            Yelp y      = new Yelp(Config.Options);
            var  result = y.GetBusiness(id).Result;

            return(View(result));
        }
Beispiel #2
0
        public void ErrorTest_UNAVAILABLE_BUSINESS()
        {
            Yelp     y        = new Yelp(Config.Options);
            Business business = y.GetBusiness("foo-bar").Result;

            Assert.IsNull(business);
        }
Beispiel #3
0
        public void BusinessTest()
        {
            var y       = new Yelp(Config.Options);
            var results = y.GetBusiness("yelp-san-francisco").Result;

            Assert.IsTrue(results != null);
        }
Beispiel #4
0
        public static YelpReviewModel GetYelpBiz(BizInfo vBiz)
        {
            YelpReviewModel yrm  = new YelpReviewModel();
            Yelp            yelp = new Yelp(Config.Options);

            //  var results = yelp.Search("Restaurants " + vBiz.BizCuisines.FirstOrDefault().CuisineTypeName, vBiz.BizAddressString).Result;
            YelpSharp.Data.Business biz = new YelpSharp.Data.Business();
            // biz=results.businesses.FirstOrDefault(e => e.phone == vBiz.ContactInfo.Phone);
            // biz = (biz == null) ? null : yelp.GetBusiness(biz.id).Result;
            biz     = string.IsNullOrEmpty(vBiz.YelpBizId)? null: yelp.GetBusiness(vBiz.YelpBizId).Result;
            yrm.Biz = biz;
            if (biz != null)
            {
                if (biz.reviews != null && biz.reviews.Count > 0)
                {
                    int lRandIndex = Helper.GetRandItem(0, biz.reviews.Count - 1);
                    yrm.Review = biz.reviews[lRandIndex];
                    if (yrm.Review.user != null)
                    {
                        yrm.User = yrm.Review.user;
                    }
                }
            }
            return(yrm);
        }
        //
        // GET: /Business/

        public ActionResult Details(string id)
        {
            Yelp y      = new Yelp(MvcApplication.Options);
            var  result = y.GetBusiness(id);

            return(View(result));
        }
Beispiel #6
0
        public async void GetBusiness(string businessId)
        {
            this.Business = null;

            Yelp yelp = new Yelp(Config.Options);

            this.Business = await yelp.GetBusiness(businessId);
        }
Beispiel #7
0
        public void BusinessTest()
        {
            var o       = GetOptions();
            var y       = new Yelp(o);
            var results = y.GetBusiness("yelp-san-francisco");

            Console.WriteLine(results);
        }
Beispiel #8
0
        public void BusinessReviewTest()
        {
            var y       = new Yelp(Config.Options);
            var results = y.GetBusiness("yelp-san-francisco").Result;

            Assert.IsTrue(results != null);

            Assert.IsNotNull(results.reviews);
            Assert.AreNotEqual(0, results.review_count);

            Assert.AreNotEqual(0, results.reviews.Count);

            var firstReview = results.reviews[0];

            Assert.IsNotNull(firstReview.rating_image_url);
            Assert.IsNotNull(firstReview.rating_image_small_url);
            Assert.IsNotNull(firstReview.rating_image_large_url);
        }
Beispiel #9
0
        private void GetYelpData(Guid id, string yelpId)
        {
            var options = new Options
            {
                AccessToken       = ConfigurationManager.AppSettings["YelpAPIToken"],
                AccessTokenSecret = ConfigurationManager.AppSettings["YelpAPITokenSecret"],
                ConsumerKey       = ConfigurationManager.AppSettings["YelpAPIConsumerKey"],
                ConsumerSecret    = ConfigurationManager.AppSettings["YelpAPIConsumerSecret"]
            };

            var      yelp     = new Yelp(options);
            Business business = yelp.GetBusiness(yelpId).Result;

            if (business != null)
            {
                UpdateAccount(id, business.rating);
            }
        }