public ActionResult Create(BlogComment blogcomment) { if (ModelState.IsValid) { db.BlogComments.Add(blogcomment); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BlogPostId = new SelectList(db.BlogPosts, "Id", "Title", blogcomment.BlogPostId); return View(blogcomment); }
public ActionResult Edit(BlogComment blogcomment) { if (ModelState.IsValid) { db.Entry(blogcomment).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BlogPostId = new SelectList(db.BlogPosts, "Id", "Title", blogcomment.BlogPostId); return View(blogcomment); }