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)); } }
public ActionResult DeleteProduct(int id) { reviewrepo.DeleteReview(id); productRepository.DeleteSize(id); productRepository.Delete(id); return(Json("done")); }
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); }
public ActionResult Delete(Guid id, FormCollection collection) { try { _reviewRepository.DeleteReview(id); return(RedirectToAction("Index")); } catch { return(View("DeleteReview")); } }
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 })); } }
// DELETE: api/Review/5 public void Delete(int uid, int rid, DateTime time) { reviewRepository.DeleteReview(uid, rid, time); }
public void DeleteReview(Guid id) { _repo.DeleteReview(id); }
public void DeleteReview(Guid reviewId) { _reviewRepo.DeleteReview(reviewId); }
public void DelReview(Guid reviewid) { _reviewrepo.DeleteReview(reviewid); }
public void DeleteReviewTest() { int res = Repo.DeleteReview(3, 3); Assert.AreEqual(0, res); }
public bool DeleteReview(int Id) { return(_reviewRepo.DeleteReview(Id)); }