public void TestDelete() { Review testReview = new Review() { Id = 2, Comment = "Bueni", Score = 5 }; List <Review> reviewsList = new List <Review>() { new Review() { Id = 4, Comment = "Bueni", Score = 4 }, }; reviewsList.Add(testReview); reviewsList.ForEach(r => _context.Add(r)); _context.SaveChanges(); var repository = new ReviewRepository(_context); repository.Delete(testReview); Assert.IsNull(_context.Reviews.Find(1)); }
public void TestgetRejectedProposalsIds() { reviewRepository.Add(review); Assert.AreEqual(1, reviewRepository.getRejectedProposalsIds().Count); reviewRepository.Delete(review); proposalRepository.Delete(proposal); }
public ActionResult Sterge(int id) { ReviewRepository r = new ReviewRepository(); r.Delete(id); return(RedirectToAction("Index")); }
public ActionResult DeleteTestCase(IList <TestCase> rows) { var testCaseRepo = new TestCaseRepository(); foreach (var row in rows) { var testCase = testCaseRepo.GetById(row.Id); if (testCase.Evidences != null && testCase.Evidences.Count > 0) { var evidenceRepo = new EvidenceRepository(); foreach (var evidence in testCase.Evidences) { System.IO.File.Delete(Server.MapPath("~/Uploads/" + evidence.Name + evidence.Extension)); evidenceRepo.Delete(evidence); } } if (testCase.Reviews != null && testCase.Reviews.Count > 0) { var reviewsRepo = new ReviewRepository(); foreach (var review in testCase.Reviews) { reviewsRepo.Delete(review); } } testCaseRepo.Delete(testCase); } TempData["success"] = "Test case/s was deleted!"; return(View("CompanyTests")); }
public void SeededReview_DeleteById_Deleted() { _reviewRepositorySUT.Delete(Seed.Review1.Id); using var dbxAssert = _dbContextFactory.CreateDbContext(); Assert.False(dbxAssert.Reviews.Any(i => i.Id == Seed.Review1.Id)); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { try { Review review = (Review)ReviewGrid.SelectedItem; if (review != null) { //TODO: Add a confirmation here. //DialogResult result = MessageBox.Show("Are you sure to delete this item?", Utils.AssemblyTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question); //if (DialogResult.Yes == result) //{ Review reviewToDelete = _reviewRepo.Get(review.ReviewId); _reviewRepo.Delete(reviewToDelete); RefreshReviewList(); //} } else { MessageBox.Show("No current row to Delete", Utils.AssemblyTitle); } } catch (Exception ex) { Utils.HandleException(ex); } }
public ActionResult Delete(int id) { Review review = reviewRepository.GetById(id); reviewRepository.Delete(review); return(RedirectToAction("Index")); }
/// <summary> /// Handles the Click event of the tbtnDelete control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void tbtnDelete_Click(object sender, EventArgs e) { try { var row = gvReviews.CurrentRow; if (row != null) { DialogResult result = MessageBox.Show("Are you sure to delete this item?", Utils.AssemblyTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == result) { var reviewId = int.Parse(row.Cells[Review.ColumnReviewId].Value.ToString()); Review reviewToDelete = _reviewRepo.Get(reviewId); _reviewRepo.Delete(reviewToDelete); RefreshReviewList(); } } else { MessageBox.Show("No current row to Delete", Utils.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { Utils.HandleException(ex); } }
public async Task <IActionResult> DeleteReview(int id) { if (!await _reviewRepository.EntityExists(id)) { return(NotFound()); } await _reviewRepository.Delete(id); return(NoContent()); }
public IHttpActionResult DeleteReview(int id) { var result = _context.Delete(id); if (result == false) { return(NotFound()); } return(Ok()); }
public void DeleteItem(Guid id) { var compositions = CompositionRepository.GetList().Where(x => x.RecipeId == id).ToList(); compositions.ForEach(x => CompositionRepository.Delete(x.Id)); var reviews = ReviewRepository.GetList().Where(x => x.RecipeId == id).ToList(); reviews.ForEach(x => ReviewRepository.Delete(x.Id)); RecipeRepository.Delete(id); }
public ActionResult Delete(int id) { var efReview = _reviewRepository.FindBy(i => i.Id == id).SingleOrDefault(); if (efReview != null) { _reviewRepository.Delete(efReview.Id); //_reviewRepository.Save(); } return(RedirectPermanent("Index")); }
public ActionResult DeleteTestGroupAll(IList <TestGroup> rows) { IList <Guid> testCasesId = new List <Guid>(); foreach (var row in rows) { var testGroupRepo = new TestGroupRepository(); TestGroup testGroup = testGroupRepo.GetById(row.Id); foreach (var testCase in testGroup.TestCases) { testCase.IsInGroup = false; testCasesId.Add(testCase.Id); } testGroupRepo.Update(testGroup); testGroupRepo.Delete(testGroup); } TestCaseRepository testCaseRepo = new TestCaseRepository(); foreach (var id in testCasesId) { TestCase testCase = testCaseRepo.GetById(id); if (testCase.Evidences != null && testCase.Evidences.Count > 0) { var evidenceRepo = new EvidenceRepository(); foreach (var evidence in testCase.Evidences) { System.IO.File.Delete(Server.MapPath("~/Uploads/" + evidence.Name + evidence.Extension)); evidenceRepo.Delete(evidence); } } if (testCase.Reviews != null && testCase.Reviews.Count > 0) { var reviewsRepo = new ReviewRepository(); foreach (var review in testCase.Reviews) { reviewsRepo.Delete(review); } } testCaseRepo.Delete(testCase); } TempData["success"] = "Test group/s and tests was deleted!"; return(View("CompanyTestGroups")); }
public void Delete_Reduces_Count() { var review = new Review() { Content = "Baby" }; underTest.Create(review); underTest.Delete(review); var count = underTest.Count(); Assert.Equal(0, count); }
public void Delete_GivenReview_RemovesReview() { var review = new Review { ReviewId = Guid.NewGuid(), ReviewPublicId = Guid.NewGuid(), Restaurant = _testContext.Restaurants.First() }; _testContext.Reviews.Add(review); _testContext.SaveChanges(); _reviewRepository.Delete(review); Assert.IsFalse(_reviewRepository.Get().Contains(review)); }
public void Delete_Reduces_Count() { var review = new Review() { Content = "I love this pony", ReviewerName = "Carl", Rating = 5.0, ProductId = 1, }; underTest.Create(review); underTest.Delete(review); var count = underTest.Count(); Assert.Equal(4, count); }
public ActionResult DeleteConfirmed(int id) { try { Review r = reviewRepository.GetById(id); if (r == null) { throw new ArgumentNullException("id"); } reviewRepository.Delete(r); return(RedirectToAction("Index")); } catch (Exception e) { log.Error($"[Reviews Controller] [Delete] Exception thrown: {e.Message}"); return(RedirectToAction("Index")); } }
public void DeleteCallRemoveOnCorrectId() { //Arrange var mockSet = new Mock <DbSet <Review> >(); mockSet.Setup(a => a.Remove(It.IsAny <Review>())).Verifiable(); mockSet.Setup(a => a.Find(It.IsAny <int>())).Returns(new Review()); var mock = new Mock <RentContext>(); mock.Setup(a => a.Reviews).Returns(mockSet.Object); //Act var repository = new ReviewRepository(mock.Object); repository.Delete(1); //Assert Mock.Verify(mockSet); }
public async Task DeleteTest() { //Arrange using (var context = new AppDbContext(options)) { var review = new GoodReview { Id = 1 }; var repo = new ReviewRepository(context); //Act context.Add(review); await repo.Delete(review.Id); var actualResult = context.Reviews.Local.Count; var expectedResult = 0; //Assert Assert.AreEqual(expectedResult, actualResult); } }
public ActionResult RemoveSave(int id) { var reviewRepository = new ReviewRepository(); // check if default hidden value is passed -- means empty form if (id == 0) { TempData["Error"] = "Unable to process, no ID was specified"; var ReviewList = reviewRepository.GetAll(); return(View("Remove", ReviewList)); } if (!ModelState.IsValid) { TempData["Error"] = "Unable to process, no ID was specified"; var ReviewList = reviewRepository.GetAll(); return(View("Remove")); } reviewRepository.Delete(id); TempData["Success"] = "Successfully Deleted Review " + id; return(View("Index")); }
public void Delete(long?id) { _reviewRepository.Delete(id); }
public ActionResult Delete(Review review) { reviewRepository = new ReviewRepository(); reviewRepository.Delete(review.Id); return(RedirectToAction("Reviews")); }
/// <summary> /// Removes the review with the given ID from the database /// </summary> /// <param name="reviewId"></param> public void removeReview(int reviewId) { reviewRepo.Delete(reviewRepo.Find(reviewId)); }
} // Register public static void Delete(int ProductId) { ReviewRepository.Delete(ProductId); } // Member
public async Task <Review> Delete(int id) { var entity = await _repository.Delete(id); return(entity); }
public void DeleteReview(int id) { revrepo.Delete(id); }
public ActionResult DeleteReview(int id) { reviewrepo.Delete(id); return(RedirectToAction("ReviewList")); }
public ActionResult DeleteConfirmed(int id) { rr.Delete(id); logger.Trace("Review Deleted"); return(RedirectToAction("Index")); }
public bool DeleteReview(int id) { return(_reviewRepository.Delete(id)); }
public void Delete(ReviewModel obj) { var recipe = _reviewMapper.MapReviewModelToReviewEntity(obj); _reviewRepository.Delete(recipe); }