public void AddComment(Comment c) { db.Comments.Add(c); db.SaveChanges(); }
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(); }