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