public async Task <int> AddAsync(T entity) { try { db.Set <T>().Add(entity); return(await db.SaveChangesAsync()); } catch (Exception e) { } return(0); }
public async Task <TEntity> CreateAsync(TEntity entity) { _context.Set <TEntity>().Add(entity); await _context.SaveChangesAsync(); return(entity); }
private DbSet <T> Set() => dataContext.Set <T>();