public ActionResult Create(Blog blog) { try { db.Blogs.Add(blog); db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, Blog blog) { try { // TODO: Add delete logic here db.Entry(blog).State = EntityState.Deleted; db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, Blog blog) { try { db.Entry(blog).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }