예제 #1
0
        public ActionResult CreateComment(Comment comment)
        {
            int filmId = Convert.ToInt32(TempData["FilmId"]);

            if (ModelState.IsValid)
            {
                comment.Date     = DateTime.Now;
                comment.UserName = User.Identity.Name;


                Film film = repo.Films.Find(m => m.Id == filmId);
                comment.Film = film;

                repo.AddComment(comment);
                repo.SaveChanges();
            }

            return(RedirectToAction("Details", new { id = filmId }));
        }