public ActionResult AddComment(int movieId, string comment, int rating) { Comment c = new Comment() { Description = comment, Rating = rating}; Movie movie = _moviesService.Get(movieId); movie.Comments.Add(c); _moviesService.Update(movie); return Json( true ); }
public ActionResult CreateComment(Comment c) { try { if (ModelState.IsValid) { Movie movie = _moviesService.Get(c.MovieID); movie.Comments.Add(c); _moviesService.Update(movie); return RedirectToRoute("Default", new { action = "Details", id = c.MovieID }); } } catch (Exception e) { ModelState.AddModelError("", String.Format("Edit Failure, inner exception: {0}", e)); } return View(c); }
public ActionResult CreateComment(int movieId) { Comment c = new Comment {MovieID = movieId}; return View(c); }