예제 #1
0
        public ActionResult Reviews()
        {
            reviewRepository = new ReviewRepository();
            var reviews = reviewRepository.GetAllReviews();

            return(View(reviews));
        }
예제 #2
0
        public IActionResult ViewReviews(Truck truck)
        {
            var repo    = new ReviewRepository();
            var reviews = repo.GetAllReviews();

            //var Reviews = repo.GetReviewsPerTruck(truck.ID);
            return(View(reviews));
        }
예제 #3
0
        public void TestGetAllReview()
        {
            var sql  = new ReviewSqlContext();
            var repo = new ReviewRepository(sql);

            var LstRvw = repo.GetAllReviews();

            Assert.AreEqual(1, LstRvw[0].AuteurId);
        }
예제 #4
0
 public void GetAllReviews()
 {
     try
     {
         // Arrange
         var reviewRepository = new ReviewRepository(RestaurantReviewsContext);
         // Act
         var reviews = reviewRepository.GetAllReviews().Result;
         // Assert
         Assert.IsTrue(reviews.Count() >= DataSeeder.Reviews.Count()
                       , string.Format("Database has {0} Reviews and Seeder has {1}", reviews.Count(), DataSeeder.Reviews.Count()));
     }
     catch (Exception ex)
     {
         Assert.Fail(string.Format("An unexpected exception occurred in GetAllReviews {0}", ex.Message));
     }
 }
예제 #5
0
        // GET: Review
        public ActionResult Index(string sortOrder)
        {
            List <ReviewModel> reviews = _reviewRepository.GetAllReviews();

            ViewBag.ReviewSortParam = string.IsNullOrEmpty(sortOrder) ? "review_desc" : "";
            ViewBag.DateSortParam   = sortOrder == "reviewdate" ? "date_desc" : "date";

            reviews = SortReviews(reviews, sortOrder);

            foreach (var review in reviews)
            {
                var member  = _memberRepository.GetMemberById(review.IdMember);
                var product = _productRepository.GetProdctById(review.IdProduct);
                review.MemberName  = member.Name;
                review.ProductName = product.ProductName;
            }

            return(View("Index", reviews));
        }
예제 #6
0
        public void GetAllReviewsTest()
        {
            int x = Repo.GetAllReviews().Count;

            Assert.AreEqual(20, x);
        }
예제 #7
0
 public List <Review> GetAllReviews()
 {
     return(_reviewRepo.GetAllReviews());
 }