public IEnumerable <ViewRestaurant> GetRestaurants(RestaurantFilter restaurantFilter) { IEnumerable <ViewRestaurant> restaurants = _viewRestaurantRepository.GetAll() .OrderByDescending(p => _restaurantRatingTask.GetConsolidatedRating(p.Id)); if (restaurantFilter == null) { return(restaurants); } if (!string.IsNullOrWhiteSpace(restaurantFilter.Name)) { restaurants = restaurants.Where( p => p.Name.IndexOf(restaurantFilter.Name, StringComparison.InvariantCultureIgnoreCase) != -1); } if (restaurantFilter.Cuisine != null) { restaurants = restaurants?.Where(p => p.Type == restaurantFilter.Cuisine.ToString()); } return(restaurants); }
public void ConsolidatedRatingBasicTest() { //Arrange var expectation = 4; //Act var actual = _restaurantRatingTask.GetConsolidatedRating(_restaurantBranchId); //Assert Assert.AreEqual(expectation, actual); }
public float Get(int restaurantBranchId) { return(_restaurantRatingTask.GetConsolidatedRating(restaurantBranchId)); }
public JsonResult GetRestaurantRating(int parameter) { return(Json(_restaurantRatingTask.GetConsolidatedRating(parameter))); }