// // GET: /Comments/Create public ActionResult Create(int movieId) { Comment c = new Comment { MovieID = movieId }; c.Rating = Comment.CommentRating.Average; //ViewBag.OptionList = ViewBagOptionList; return View(c); }
public ActionResult Create(Comment c) { try { if (ModelState.IsValid) { Movie movie = _moviesService.Get(c.MovieID); movie.Comments.Add(c); _moviesService.Update(movie); return RedirectToRoute("Default", new { controller = "Movies", action = "Details", id = c.MovieID }); } } catch (Exception e) { ModelState.AddModelError("", String.Format("Edit Failure, inner exception: {0}", e)); } //ViewBag.OptionList = ViewBagOptionList; return View(c); }