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