示例#1
0
 public Repeat Create(Repeat t)
 {
     using (var db = new GamisignmentContext())
     {
         db.Repeats.Add(t);
         db.SaveChanges();
         return(t);
     }
 }
示例#2
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);
     }
 }
示例#3
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);
            }
        }