Example #1
0
 public ActionResult CreateAjax(Comment comment)
 {
     if (ModelState.IsValid)
     {
         db.Comments.Add(comment);
         db.SaveChanges();
         return RedirectToAction("Index",comment.ParentType, new{ Id=comment.ParentId});
     }
     return RedirectToAction("Index", comment.ParentType, new { Id = comment.ParentId });
 }
Example #2
0
        public ActionResult Create(Comment comment)
        {
            if (ModelState.IsValid)
            {
                var returnTrue = new JsonResult();

                db.Comments.Add(comment);
                db.SaveChanges();
                return RedirectToAction("Details", "PublicationModel", new { id = comment.ParentId });

            }

            return View(comment);
        }
Example #3
0
 public ActionResult Edit(Comment comment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(comment).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(comment);
 }