예제 #1
0
 public void DeleteReview()
 {
     try
     {
         // Arrange
         var reviewRepository = new ReviewRepository(RestaurantReviewsContext);
         var newReview        = new Review
         {
             Comment        = "Good food.",
             Rating         = 4,
             RestaurauntId  = DataSeeder.Restaurants[0].Id,
             SubmissionDate = DateTime.UtcNow,
             UserId         = DataSeeder.Users[0].Id
         };
         reviewRepository.CreateReview(newReview).Wait();
         var savedReview = reviewRepository.GetReviewById(newReview.Id).Result;
         Assert.IsNotNull(savedReview, string.Format("Review {0} was not saved in the database", newReview.Id));
         Assert.IsTrue(savedReview.Comment == newReview.Comment, string.Format("Review({0}).Comment was not saved in the database", newReview.Id));
         // Act
         reviewRepository.DeleteReview(savedReview).Wait();
         // Assert
         var shouldBeDeletedReview = reviewRepository.GetReviewById(newReview.Id).Result;
         Assert.IsTrue(shouldBeDeletedReview.IsEmptyObject(), string.Format("Review({0}) was not deleted from the database", newReview.Id));
     }
     catch (Exception ex)
     {
         Assert.Fail(string.Format("An unexpected exception occurred in DeleteReview {0}", ex.Message));
     }
 }
예제 #2
0
 public ActionResult DeleteProduct(int id)
 {
     reviewrepo.DeleteReview(id);
     productRepository.DeleteSize(id);
     productRepository.Delete(id);
     return(Json("done"));
 }
예제 #3
0
        public static bool DeleteReview(int reviewId)
        {
            Review currentReview = ReviewRepository.GetReviewById(reviewId);

            if (currentReview != null)
            {
                return(ReviewRepository.DeleteReview(currentReview));
            }
            return(false);
        }
        public Review DeleteReview(int reviewId)
        {
            var deletedMovie = reviewRepo.DeleteReview(reviewId);

            reviewRepo.Save();
            return(deletedMovie);

            //var reviewInDb = _movie.Reviews.SingleOrDefault(r => r.ReviewId == reviewId);
            //reviewRepo.DeleteReview(reviewId);
        }
예제 #5
0
        public ActionResult Delete(Guid id, FormCollection collection)
        {
            try
            {
                _reviewRepository.DeleteReview(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("DeleteReview"));
            }
        }
예제 #6
0
        public IActionResult Delete(int id)
        {
            ReviewViewModel vm = Converter.ReviewToReviewViewModel(Repo.GetReviewByID(id));

            if (vm.PostedById == Convert.ToInt32(this.User.FindFirstValue(ClaimTypes.NameIdentifier)))
            {
                Repo.DeleteReview(vm.ReviewId, vm.PostedById);
                return(RedirectToAction("Detail", "Book", new { Id = vm.BookReviewed }));
            }
            else
            {
                return(View(new ErrorViewModel {
                    RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
                }));
            }
        }
예제 #7
0
 // DELETE: api/Review/5
 public void Delete(int uid, int rid, DateTime time)
 {
     reviewRepository.DeleteReview(uid, rid, time);
 }
예제 #8
0
 public void DeleteReview(Guid id)
 {
     _repo.DeleteReview(id);
 }
예제 #9
0
 public void DeleteReview(Guid reviewId)
 {
     _reviewRepo.DeleteReview(reviewId);
 }
예제 #10
0
 public void DelReview(Guid reviewid)
 {
     _reviewrepo.DeleteReview(reviewid);
 }
예제 #11
0
        public void DeleteReviewTest()
        {
            int res = Repo.DeleteReview(3, 3);

            Assert.AreEqual(0, res);
        }
예제 #12
0
 public bool DeleteReview(int Id)
 {
     return(_reviewRepo.DeleteReview(Id));
 }