public void Remove(Review review)
 {
     using (var session = NHibernateHelper.OpenSession())
     using (var transaction = session.BeginTransaction())
     {
         session.Delete(review);
         transaction.Commit();
     }
 }
 private static bool IsInReviewCollection(Review review, IEnumerable<Review> fromDb)
 {
     return fromDb.Any(item => review.Id == item.Id);
 }
        public ActionResult ProductDetails(ReviewRowModel model, int id)
        {
            var review = new Review {ProductId = id, Rating = model.Rating, Detail = model.DetailedReview,
                UserId= _submitterRepository.CheckExistingNamesAdd(model.SubmitterName)};

            _reviewRepository.Add(review);

            return Redirect("/Product/ProductDetails/" + id);
        }
        public void CanAddNewReview()
        {
            var review = new Review
            {
                Detail = "TestReview6",
                Rating = 5,
                ProductId = 1,
                UserId = 1,
            };

            IReviewRepository repository = new ReviewRepository();
            repository.Add(review);

            // use session to try to load the Review
            using (ISession session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<Review>(review.Id);
                // Test that the Review was successfully inserted
                Assert.IsNotNull(fromDb);
                Assert.AreNotSame(review, fromDb);
                Assert.AreEqual(review.ProductId, fromDb.ProductId);
                Assert.AreEqual(review.UserId, fromDb.UserId);
                Assert.AreEqual(review.Detail, fromDb.Detail);
                Assert.AreEqual(review.Rating, fromDb.Rating);
            }
        }