Exemplo n.º 1
0
 public ActionResult Comment(BlogComment blogcomment)
 {
     if (ModelState.IsValid)
     {
         db.Comments.Add(blogcomment.Comment);             
         db.SaveChanges();
         return RedirectToAction("Comment");
     }
     return View(blogcomment);
 }
Exemplo n.º 2
0
        // GET: Blogs/Edit/5
        public ActionResult Comment(int? id)
        {                
            
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            Blog blog = db.Blogs.Find(id);
            if (blog == null)
            {
                return HttpNotFound();
            }
            BlogComment bc = new BlogComment();
            bc.Blog = blog;
            bc.Comment = new Comment();
            return View(bc);
        }