public IActionResult FlagReview(Guid ReviewId) { if (ModelState.IsValid) { var rev = reviewRepository.GetById(ReviewId); reviewRepository.MarkDeleted(rev); reviewRepository.CommitChanges(); Guid AdminId = Guid.Parse(this.User.FindFirstValue(ClaimTypes.NameIdentifier)); FlaggedReview flaggedRev = new FlaggedReview(); flaggedRev.AdminUserId = AdminId; flaggedRev.ReviewId = ReviewId; flaggedRev.Comments = " "; flaggedReviewRepository.Insert(flaggedRev); flaggedReviewRepository.CommitChanges(); return(RedirectToAction("ViewReviews")); } else { ModelState.AddModelError("Error", "Review couldnt be flagged."); return(RedirectToAction("Error", "AdminUser")); } }