Example #1
0
        public async Task <int> AddAsync(T entity)
        {
            try
            {
                db.Set <T>().Add(entity);

                return(await db.SaveChangesAsync());
            } catch (Exception e) { }

            return(0);
        }
Example #2
0
        public async Task <TEntity> CreateAsync(TEntity entity)
        {
            _context.Set <TEntity>().Add(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
Example #3
0
 private DbSet <T> Set() => dataContext.Set <T>();