public Task <int> CommitAsync() { try { var returnValue = dbcontext.SaveChangesAsync(); if (dbTransaction != null) { dbTransaction.Commit(); } return(returnValue); } catch (Exception) { if (dbTransaction != null) { this.dbTransaction.Rollback(); } throw; } finally { this.Dispose(); } }
public Task <int> InsertAsync(TEntity entity) { dbcontext.Entry <TEntity>(entity).State = EntityState.Added; return(dbcontext.SaveChangesAsync()); }