Beispiel #1
0
 public bool Delete(int id)
 {
     using (var db = new GamisignmentContext())
     {
         var delete = db.Repeats.FirstOrDefault(x => x.Id == id);
         db.Entry(delete).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
         return(db.Repeats.FirstOrDefault(x => x.Id == id) == null);
     }
 }
Beispiel #2
0
        public Repeat Update(Repeat t)
        {
            using (var db = new GamisignmentContext())
            {
                //3. Mark entity as modified
                db.Entry(t).State = System.Data.Entity.EntityState.Modified;

                //4. call SaveChanges
                db.SaveChanges();
                return(t);
            }
        }