public ActionResult Edit(BlogPost blogpost) { if (ModelState.IsValid) { db.Entry(blogpost).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(blogpost); }
public ActionResult Create(BlogPost blogpost) { if (ModelState.IsValid) { db.BlogPosts.Add(blogpost); db.SaveChanges(); return RedirectToAction("Index"); } return View(blogpost); }