Exemplo n.º 1
0
        public bool UpdateLogo(int restaurantId, string imageLocation)
        {
            Restaurant rest = restRepo.Get(restaurantId);

            rest.ImageLocation = imageLocation;
            return(restRepo.Update(rest, rest.Id));
        }
        public void Get_OnCall_ReturnsAllRestuarants()
        {
            var restaurants = new List <Restaurant>
            {
                new Restaurant
                {
                    RestaurantId       = Guid.NewGuid(),
                    RestaurantPublicId = Guid.NewGuid()
                },
                new Restaurant
                {
                    RestaurantId       = Guid.NewGuid(),
                    RestaurantPublicId = Guid.NewGuid()
                },
                new Restaurant
                {
                    RestaurantId       = Guid.NewGuid(),
                    RestaurantPublicId = Guid.NewGuid()
                }
            };

            _textContext.Restaurants.RemoveRange(_textContext.Restaurants);
            _textContext.Restaurants.AddRange(restaurants);
            _textContext.SaveChanges();

            var result = _restaurantRepository.Get();

            const int expected = 3;

            Assert.AreEqual(expected, result.Count());
        }
 public ActionResult MenusAndOffers(int id)
 {
     ViewData["RestaurantReviews"] = postrepo.GetPostsByRestaurantId(id);
     ViewData["RestaurantInfo"]    = repo.Get(id);
     ViewData["Offers"]            = offerrepo.getAllOffersByRestaurantId(id);
     return(View(this.menurepo.getAllMenusByRestaurantId(id)));
 }
        public void GetAverageRatingTest()
        {
            var restaurant = _restaurantRepo.Get(1);
            var avgRating  = _restaurantRepo.GetAverageRating(restaurant);

            Assert.AreEqual(avgRating <5.0 && avgRating> 4.0, true);
        }
Exemplo n.º 5
0
        public async Task <IHttpActionResult> Get(string id = null)
        {
            try
            {
                var one = await _repository.Get(id);

                return(Json(one));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        /// <summary>
        /// Get restaurants
        /// </summary>
        /// <param name="request">request for getting restaurants</param>
        /// <returns>returns response of the operation</returns>
        public GetRestaurantResponse Get(GetRestaurantRequest request)
        {
            //Get restaurants
            var restaurantEntities = _restaurantRepository.Get();

            //Prepare response by using restaurantEnitites
            var response = new GetRestaurantResponse();

            response.Restaurants = restaurantEntities.Select(restaurant => new RestaurantDTO
            {
                ID              = restaurant.ID,
                Latitude        = restaurant.Latitude,
                Longitude       = restaurant.Longitude,
                SupplyDayOfWeek = restaurant.SupplyDayOfWeek
            }).ToList();

            return(response);
        }
        public void RepoAdd_AddRestaurant_CheckAdded()
        {
            //Arrange
            var dbmock = new RRRavesDBEntities();


            var restrepo = new RestaurantRepository(dbmock);


            Restaurant restaurantEx = new Restaurant();

            restaurantEx.ID_Restaurant = 12;


            //Act
            restrepo.Add(restaurantEx);
            var actual = restrepo.Get(restaurantEx.ID_Restaurant);

            //Assert
            Assert.Equal(restaurantEx, actual);
        }
Exemplo n.º 8
0
        public IHttpActionResult Get(int id)
        {
            var result = _rep.Get(id);

            return(Ok(result));
        }
Exemplo n.º 9
0
 public Restaurant GetRestaurant(int restaurantId)
 {
     return(_restaurantRepository.Get(restaurantId));
 }
Exemplo n.º 10
0
 public RestaurantEntity Get(int id)
 {
     return(_restaurant.Get(id));
 }
Exemplo n.º 11
0
 public RestaurantModel Get(int id)
 {
     return(restaurantRepo.Get(id).ToContract());
 }