예제 #1
0
 public ActionResult Add(MovieReview model)
 {
     using (var db = new MovieReviewsEntities())
     {
         db.MovieReviews.Add(model);
         db.SaveChanges();
     }
     return RedirectToAction("index", new { movieId = model.MovieID });
     //How do I return this to a view operated by a different controller? Or would I never really want to?
 }
예제 #2
0
 public ActionResult Delete(int moviereviewId)
 {
     using (var db = new MovieReviewsEntities())
     {
         var reviewToDelete = new MovieReview
         {
             MovieReviewID = moviereviewId
         };
         db.MovieReviews.Attach(reviewToDelete);
         db.MovieReviews.Remove(reviewToDelete);
         db.SaveChanges();
     }
     return RedirectToAction("Index");
 }