Пример #1
0
 public void AddComment(Comment c)
 {
     db.Comments.Add(c);
     db.SaveChanges();
 }
Пример #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();
 }