public virtual void Edit(T entity) { using (var dbContext = new LivescoreDbContext()) { var dbSet = GetDbSet(dbContext); dbContext.Entry(entity).State = EntityState.Modified; dbContext.SaveChanges(); } }
public virtual T Add(T entity) { using (var dbContext = new LivescoreDbContext()) { dbContext.Entry(entity).State = EntityState.Added; dbContext.SaveChanges(); return(entity); } }
public virtual void Delete(int id) { using (var dbContext = new LivescoreDbContext()) { var dbSet = GetDbSet(dbContext); var entity = dbSet.Find(id); dbContext.Entry(entity).State = EntityState.Deleted; dbContext.SaveChanges(); } }