public IEnumerable <Review> GetReview() { IEnumerable <Review> reviews = _reviewRepo.GetReviews(); if (reviews != null) { _logger.LogInformation("Getting all reviews."); return(reviews.ToList()); } _logger.LogWarning("Attempted to get reviews but no reviews were available."); return(null); }
public async Task <IActionResult> getReviews([FromQuery] long?userId, [FromQuery] long?restaurantId, [FromQuery] bool sortLowToHigh) { if (!userId.HasValue && !restaurantId.HasValue) { return(BadRequest( new BasicResponse { Status = "Bad Request", FailureMessage = "Must provide either the userId or restaurantId or both in the query parameters" } )); } return(await toHttpResponseWithPayload(() => _reviewRepository.GetReviews(userId, restaurantId, sortLowToHigh), _logger)); }