public virtual async Task <T> AddAsync(T entity) { _context.Entry(entity).State = EntityState.Added; await _context.SaveChangesAsync(); return(entity); }
public void Delete(TEntity entityToDelete) { if (Db.Entry(entityToDelete).State == EntityState.Detached) { DbSet.Attach(entityToDelete); } DbSet.Remove(entityToDelete); }
public async Task Update(T entity) { context.Entry(entity).State = EntityState.Modified; await context.SaveChangesAsync(); }
public async Task UpdateAsync(TEntity entity) { await Task.Run(() => _context.Entry(entity).State = EntityState.Modified); }
public void Update(TEntity entity) { _context.Entry(entity).State = EntityState.Modified; DbSet.Update(entity); }