public ActionResult Delete(int id, Blog blog) { try { using (var db = new BlogDataEntities()) { db.Entry(blog).State = System.Data.EntityState.Deleted; db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Blog blog) { try { using (var db = new BlogDataEntities()) { db.Blogs.Add(blog); db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }