Beispiel #1
0
        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"));
        }
Beispiel #2
0
        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"));
        }