예제 #1
0
        public void AddTestRestaurant()
        {
            if (_restaurantRepo.GetAll().Count() > 0)
            {
                return;
            }
            var generic1 = CreateTestRestaurant("generic restaurant 1", RestaurantType.FastFood, "Generic Food", 20.5, "9-5", "6666 generic ave", "picture1.jpg", false, "www.generic.com", "555-5555", true, " ");
            var generic2 = CreateTestRestaurant("generic restaurant 2", RestaurantType.Buffet, "Generic buffet Food", 15, "9-12", "7777 generic ave", "picture2.jpg", true, "www.generic2.com", "666-6666", false, " ");
            var real     = CreateTestRestaurant("applebees grill bar lubbock", RestaurantType.FamilyStyle, "American Bar and grill", 11, "11-12", "025 S Loop 289, Lubbock, TX 79423", @"https://s3-media2.fl.yelpcdn.com/bphoto/MMidaq5xH86SPi-dJWhWfw/o.jpg\", true, @"https://www.applebees.com/en", "+18067854025", false, "{\"businesses\": [{\"id\": \"4w0gvAjfFJbjP1_GX7jWxA\", \"alias\": \"applebees-grill-bar-lubbock\", \"name\": \"Applebee's Grill + Bar\", \"image_url\": \"https://s3-media2.fl.yelpcdn.com/bphoto/MMidaq5xH86SPi-dJWhWfw/o.jpg\", \"is_closed\": false, \"url\": \"https://www.yelp.com/biz/applebees-grill-bar-lubbock?adjust_creative=dkkmRxsUIEmWGpLseCr51g&utm_campaign=yelp_api_v3&utm_medium=api_v3_phone_search&utm_source=dkkmRxsUIEmWGpLseCr51g\", \"review_count\": 55, \"categories\": [{\"alias\": \"tradamerican\", \"title\": \"American (Traditional)\"}, {\"alias\": \"sportsbars\", \"title\": \"Sports Bars\"}, {\"alias\": \"burgers\", \"title\": \"Burgers\"}], \"rating\": 2.0, \"coordinates\": {\"latitude\": 33.528844, \"longitude\": -101.901284}, \"transactions\": [\"delivery\"], \"price\": \"$$\", \"location\": {\"address1\": \"4025 South Loop 289\", \"address2\": \"\", \"address3\": \"\", \"city\": \"Lubbock\", \"zip_code\": \"79423\", \"country\": \"US\", \"state\": \"TX\", \"display_address\": [\"4025 South Loop 289\", \"Lubbock, TX 79423\"]}, \"phone\": \"+18067854025\", \"display_phone\": \"(806) 785-4025\"}], \"total\": 1}");

            _restaurantRepo.Add(generic1);
            _restaurantRepo.Add(generic2);
            _restaurantRepo.Add(real);
        }
        public Restaurant Add(Restaurant restaurant)
        {
            var yelp = GetYelpApiJsonForRestaurant(restaurant.PhoneNumber);

            restaurant.YelpJSON = yelp;
            var Restaurant = _restaurantRepo.Add(restaurant);

            return(Restaurant);
        }
예제 #3
0
        /// <summary>
        /// save data to database
        /// </summary>
        /// <param name="model"></param>
        public void Add(RestaurantViewModel model)
        {
            var list = new List <Address>();

            list.Add(new Address()
            {
                Street     = model.Street,
                City       = model.City,
                Country    = model.Country,
                PostalCode = model.PostalCode
            });
            var restaurant = new Restaurant()
            {
                Description = model.Description,
                Name        = model.Name,
                Type        = model.Type,
                Addresses   = list
            };

            restaurantRepo.Add(restaurant);
        }
 public void AddRestaurant(Restaurant restaurant)
 {
     _restaurantRepo.Add(restaurant);
 }
예제 #5
0
 public void Create(Restaurant entity)
 {
     _RestaurantRepo.Add(entity);
 }
예제 #6
0
 public Restaurant Add(Restaurant restaurant)
 {
     return(_restaurantContext.Add(restaurant));
 }