public ActionResult Create([Bind(Include = "Id,Title,Content")] Snippet snippet) { if (ModelState.IsValid) { db.Snippets.Add(snippet); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(snippet)); }
protected bool Update(T obj) { if (ModelState.IsValid) { db.Entry(obj).State = System.Data.Entity.EntityState.Modified; try { db.SaveChanges(); return(true); } catch { return(false); } } return(false); }