Exemplo n.º 1
0
 public void AddComment(Comment c)
 {
     db.Comments.Add(c);
     db.SaveChanges();
 }
Exemplo n.º 2
0
 public ActionResult PostComment(int subtitleId, string comment)
 {
     if (ModelState.IsValid)
     {
         Comment newComment = new Comment();
         newComment.Text = comment;
         newComment.Author = User.Identity.Name;
         newComment.SubtitleId = subtitleId;
         db.AddComment(newComment);
         return RedirectToAction("Details", "Subtitle", new { id = subtitleId });
     }
     return View();
 }