public void AddComment(Comment comment)
 {
     var model = (from m in m_subtitles
                  where m.Id == comment.SubtitleId
                  select m).SingleOrDefault();
     model.Comments.Add(comment);
 }
Example #2
0
 public void AddComment(Comment comment)
 {
     var theSubtitle = (from c in m_db.Subtitles
                        where c.Id == comment.SubtitleId
                       select c).SingleOrDefault();
     theSubtitle.Comments.Add(comment);
     m_db.SaveChanges();
 }
Example #3
0
        public ActionResult AddComment(Comment comment)
        {
            string userId = User.Identity.GetUserId();
                DateTime timi = DateTime.Now;
                Comment newComment = new Comment { UserId = userId, SubtitleId = comment.SubtitleId, CommentText = comment.CommentText, DateSubmitted = timi };
                m_repo.AddComment(newComment);

                return Json("", JsonRequestBehavior.AllowGet);
        }
Example #4
0
 public ActionResult TestAddComment(string comment, int? subtitleid)
 {
     if (subtitleid.HasValue && !String.IsNullOrEmpty(comment))
     {
         DateTime timi = DateTime.Now;
         Comment newComment = new Comment {  SubtitleId = subtitleid.Value, CommentText = comment, DateSubmitted = timi };
         return View(newComment);
     }
     else if (!subtitleid.HasValue)
     {
         return View("Error");
     }
     else
     {
         ModelState.AddModelError("comment", "Commenttext cannot be empty!");
         return View("Error");
     }
 }