public ActionResult Index(Review model)
        {
            try
            {
                desi.AddReview(model);

                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                return RedirectToAction("Index", new { Error = ex.Message });
            }
        }
 public bool AddReview(Review review)
 {
     try
     {
         if (_ctx.Reviews.Where(x => x.MovieId == review.MovieId).Count() > 0)
         {
             var reviewToUpdate = _ctx.Reviews.Single(x => x.MovieId == review.MovieId);
             reviewToUpdate.ReviewContent = review.ReviewContent;
         }
         else
         _ctx.Reviews.Add(review);
         return _ctx.SaveChanges() > 0;
     }
     catch (DbUpdateException)
     {
         return false;
     }
 }
Exemplo n.º 3
0
 public bool AddReview(Review movieReview)
 {
     return _repo.AddReview(movieReview);
 }
 // GET: ReviewPageAdmin
 public ActionResult Index()
 {
     Review model = new Review();
     model.ExistingMovies = desi.GetMovieDropdown();
     return View(model);
 }