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