public ActionResult Delete(int id) { var db = new ChrisbzdEntities(); var set = db.Set(typeof(T)); var c = set.Find(id); set.Remove(c); db.SaveChanges(); return(RedirectToAction("List")); }
public ActionResult Details(int id) { var db = new ChrisbzdEntities(); var set = db.Set(typeof(T)); object o = null; if (id > 0) { o = set.Find(id); } else { o = set.Create(); } return(View(o)); }
public ActionResult Details(T o) { ChrisbzdEntities db = new ChrisbzdEntities(); var set = db.Set(typeof(T)); if (this.IsNew(o)) { set.Add(o); } else { db.Entry((object)o).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } db.SaveChanges(); return(RedirectToAction("List")); }
public ActionResult List() { var db = new ChrisbzdEntities(); return(View(db.Set(typeof(T)))); }